opj_bio_create:
  114|  33.1M|{
  115|  33.1M|    opj_bio_t *bio = (opj_bio_t*)opj_malloc(sizeof(opj_bio_t));
  116|  33.1M|    return bio;
  117|  33.1M|}
opj_bio_destroy:
  120|  33.1M|{
  121|  33.1M|    if (bio) {
  ------------------
  |  Branch (121:9): [True: 33.1M, False: 0]
  ------------------
  122|  33.1M|        opj_free(bio);
  123|  33.1M|    }
  124|  33.1M|}
opj_bio_numbytes:
  127|  33.1M|{
  128|  33.1M|    return (bio->bp - bio->start);
  129|  33.1M|}
opj_bio_init_dec:
  141|  33.1M|{
  142|  33.1M|    bio->start = bp;
  143|  33.1M|    bio->end = bp + len;
  144|  33.1M|    bio->bp = bp;
  145|  33.1M|    bio->buf = 0;
  146|  33.1M|    bio->ct = 0;
  147|  33.1M|}
opj_bio_read:
  170|  33.7M|{
  171|  33.7M|    OPJ_INT32 i;
  172|  33.7M|    OPJ_UINT32 v;
  173|       |
  174|  33.7M|    assert((n > 0U) /* && (n <= 32U)*/);
  175|       |#ifdef OPJ_UBSAN_BUILD
  176|       |    /* This assert fails for some corrupted images which are gracefully rejected */
  177|       |    /* Add this assert only for ubsan build. */
  178|       |    /* This is the condition for overflow not to occur below which is needed because of OPJ_NOSANITIZE */
  179|       |    assert(n <= 32U);
  180|       |#endif
  181|  33.7M|    v = 0U;
  182|  67.7M|    for (i = (OPJ_INT32)n - 1; i >= 0; i--) {
  ------------------
  |  Branch (182:32): [True: 34.0M, False: 33.7M]
  ------------------
  183|  34.0M|        v |= opj_bio_getbit(bio) <<
  184|  34.0M|             i; /* can't overflow, opj_bio_getbit returns 0 or 1 */
  185|  34.0M|    }
  186|  33.7M|    return v;
  187|  33.7M|}
opj_bio_inalign:
  203|  33.1M|{
  204|  33.1M|    if ((bio->buf & 0xff) == 0xff) {
  ------------------
  |  Branch (204:9): [True: 282, False: 33.1M]
  ------------------
  205|    282|        if (! opj_bio_bytein(bio)) {
  ------------------
  |  Branch (205:13): [True: 2, False: 280]
  ------------------
  206|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
  207|      2|        }
  208|    282|    }
  209|  33.1M|    bio->ct = 0;
  210|  33.1M|    return OPJ_TRUE;
  ------------------
  |  |  117|  33.1M|#define OPJ_TRUE 1
  ------------------
  211|  33.1M|}
bio.c:opj_bio_getbit:
   98|  34.0M|{
   99|  34.0M|    if (bio->ct == 0) {
  ------------------
  |  Branch (99:9): [True: 33.2M, False: 776k]
  ------------------
  100|  33.2M|        opj_bio_bytein(
  101|  33.2M|            bio); /* MSD: why not check the return value of this function ? */
  102|  33.2M|    }
  103|  34.0M|    bio->ct--;
  104|  34.0M|    return (bio->buf >> bio->ct) & 1;
  105|  34.0M|}
bio.c:opj_bio_bytein:
   87|  33.2M|{
   88|  33.2M|    bio->buf = (bio->buf << 8) & 0xffff;
   89|  33.2M|    bio->ct = bio->buf == 0xff00 ? 7 : 8;
  ------------------
  |  Branch (89:15): [True: 4.21k, False: 33.2M]
  ------------------
   90|  33.2M|    if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
  ------------------
  |  Branch (90:9): [True: 33.1M, False: 126k]
  ------------------
   91|  33.1M|        return OPJ_FALSE;
  ------------------
  |  |  118|  33.1M|#define OPJ_FALSE 0
  ------------------
   92|  33.1M|    }
   93|   126k|    bio->buf |= *bio->bp++;
   94|   126k|    return OPJ_TRUE;
  ------------------
  |  |  117|   126k|#define OPJ_TRUE 1
  ------------------
   95|  33.2M|}

opj_read_bytes_LE:
   84|  2.30M|{
   85|  2.30M|    OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + p_nb_bytes - 1;
   86|  2.30M|    OPJ_UINT32 i;
   87|       |
   88|  2.30M|    assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));
   89|       |
   90|  2.30M|    *p_value = 0;
   91|  6.69M|    for (i = 0; i < p_nb_bytes; ++i) {
  ------------------
  |  Branch (91:17): [True: 4.39M, False: 2.30M]
  ------------------
   92|  4.39M|        *(l_data_ptr--) = *(p_buffer++);
   93|  4.39M|    }
   94|  2.30M|}
opj_read_double_LE:
  119|  2.00k|{
  120|  2.00k|    OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + sizeof(OPJ_FLOAT64) - 1;
  121|  2.00k|    OPJ_UINT32 i;
  122|  18.0k|    for (i = 0; i < sizeof(OPJ_FLOAT64); ++i) {
  ------------------
  |  Branch (122:17): [True: 16.0k, False: 2.00k]
  ------------------
  123|  16.0k|        *(l_data_ptr--) = *(p_buffer++);
  124|  16.0k|    }
  125|  2.00k|}
opj_read_float_LE:
  150|  2.27k|{
  151|  2.27k|    OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + sizeof(OPJ_FLOAT32) - 1;
  152|  2.27k|    OPJ_UINT32 i;
  153|  11.3k|    for (i = 0; i < sizeof(OPJ_FLOAT32); ++i) {
  ------------------
  |  Branch (153:17): [True: 9.10k, False: 2.27k]
  ------------------
  154|  9.10k|        *(l_data_ptr--) = *(p_buffer++);
  155|  9.10k|    }
  156|  2.27k|}
opj_stream_create:
  160|  8.85k|{
  161|  8.85k|    opj_stream_private_t * l_stream = 00;
  162|  8.85k|    l_stream = (opj_stream_private_t*) opj_calloc(1, sizeof(opj_stream_private_t));
  163|  8.85k|    if (! l_stream) {
  ------------------
  |  Branch (163:9): [True: 0, False: 8.85k]
  ------------------
  164|      0|        return 00;
  165|      0|    }
  166|       |
  167|  8.85k|    l_stream->m_buffer_size = p_buffer_size;
  168|  8.85k|    l_stream->m_stored_data = (OPJ_BYTE *) opj_malloc(p_buffer_size);
  169|  8.85k|    if (! l_stream->m_stored_data) {
  ------------------
  |  Branch (169:9): [True: 0, False: 8.85k]
  ------------------
  170|      0|        opj_free(l_stream);
  171|      0|        return 00;
  172|      0|    }
  173|       |
  174|  8.85k|    l_stream->m_current_data = l_stream->m_stored_data;
  175|       |
  176|  8.85k|    if (l_is_input) {
  ------------------
  |  Branch (176:9): [True: 8.85k, False: 0]
  ------------------
  177|  8.85k|        l_stream->m_status |= OPJ_STREAM_STATUS_INPUT;
  ------------------
  |  |   74|  8.85k|#define OPJ_STREAM_STATUS_INPUT   0x2U
  ------------------
  178|  8.85k|        l_stream->m_opj_skip = opj_stream_read_skip;
  179|  8.85k|        l_stream->m_opj_seek = opj_stream_read_seek;
  180|  8.85k|    } else {
  181|      0|        l_stream->m_status |= OPJ_STREAM_STATUS_OUTPUT;
  ------------------
  |  |   73|      0|#define OPJ_STREAM_STATUS_OUTPUT  0x1U
  ------------------
  182|      0|        l_stream->m_opj_skip = opj_stream_write_skip;
  183|      0|        l_stream->m_opj_seek = opj_stream_write_seek;
  184|      0|    }
  185|       |
  186|  8.85k|    l_stream->m_read_fn = opj_stream_default_read;
  187|  8.85k|    l_stream->m_write_fn = opj_stream_default_write;
  188|  8.85k|    l_stream->m_skip_fn = opj_stream_default_skip;
  189|  8.85k|    l_stream->m_seek_fn = opj_stream_default_seek;
  190|       |
  191|  8.85k|    return (opj_stream_t *) l_stream;
  192|  8.85k|}
opj_stream_destroy:
  200|  8.85k|{
  201|  8.85k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  202|       |
  203|  8.85k|    if (l_stream) {
  ------------------
  |  Branch (203:9): [True: 8.85k, False: 0]
  ------------------
  204|  8.85k|        if (l_stream->m_free_user_data_fn) {
  ------------------
  |  Branch (204:13): [True: 0, False: 8.85k]
  ------------------
  205|      0|            l_stream->m_free_user_data_fn(l_stream->m_user_data);
  206|      0|        }
  207|  8.85k|        opj_free(l_stream->m_stored_data);
  208|  8.85k|        l_stream->m_stored_data = 00;
  209|  8.85k|        opj_free(l_stream);
  210|  8.85k|    }
  211|  8.85k|}
opj_stream_set_read_function:
  215|  8.85k|{
  216|  8.85k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  217|       |
  218|  8.85k|    if ((!l_stream) || (!(l_stream->m_status & OPJ_STREAM_STATUS_INPUT))) {
  ------------------
  |  |   74|  8.85k|#define OPJ_STREAM_STATUS_INPUT   0x2U
  ------------------
  |  Branch (218:9): [True: 0, False: 8.85k]
  |  Branch (218:24): [True: 0, False: 8.85k]
  ------------------
  219|      0|        return;
  220|      0|    }
  221|       |
  222|  8.85k|    l_stream->m_read_fn = p_function;
  223|  8.85k|}
opj_stream_set_seek_function:
  227|  8.85k|{
  228|  8.85k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  229|       |
  230|  8.85k|    if (!l_stream) {
  ------------------
  |  Branch (230:9): [True: 0, False: 8.85k]
  ------------------
  231|      0|        return;
  232|      0|    }
  233|  8.85k|    l_stream->m_seek_fn = p_function;
  234|  8.85k|}
opj_stream_set_skip_function:
  250|  8.85k|{
  251|  8.85k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  252|       |
  253|  8.85k|    if (! l_stream) {
  ------------------
  |  Branch (253:9): [True: 0, False: 8.85k]
  ------------------
  254|      0|        return;
  255|      0|    }
  256|       |
  257|  8.85k|    l_stream->m_skip_fn = p_function;
  258|  8.85k|}
opj_stream_set_user_data:
  262|  8.85k|{
  263|  8.85k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  264|  8.85k|    if (!l_stream) {
  ------------------
  |  Branch (264:9): [True: 0, False: 8.85k]
  ------------------
  265|      0|        return;
  266|      0|    }
  267|  8.85k|    l_stream->m_user_data = p_data;
  268|  8.85k|    l_stream->m_free_user_data_fn = p_function;
  269|  8.85k|}
opj_stream_set_user_data_length:
  273|  8.85k|{
  274|  8.85k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  275|  8.85k|    if (!l_stream) {
  ------------------
  |  Branch (275:9): [True: 0, False: 8.85k]
  ------------------
  276|      0|        return;
  277|      0|    }
  278|  8.85k|    l_stream->m_user_data_length = data_length;
  279|  8.85k|}
opj_stream_read_data:
  283|  1.85M|{
  284|  1.85M|    OPJ_SIZE_T l_read_nb_bytes = 0;
  285|  1.85M|    if (p_stream->m_bytes_in_buffer >= p_size) {
  ------------------
  |  Branch (285:9): [True: 1.84M, False: 15.3k]
  ------------------
  286|  1.84M|        memcpy(p_buffer, p_stream->m_current_data, p_size);
  287|  1.84M|        p_stream->m_current_data += p_size;
  288|  1.84M|        p_stream->m_bytes_in_buffer -= p_size;
  289|  1.84M|        l_read_nb_bytes += p_size;
  290|  1.84M|        p_stream->m_byte_offset += (OPJ_OFF_T)p_size;
  291|  1.84M|        return l_read_nb_bytes;
  292|  1.84M|    }
  293|       |
  294|       |    /* we are now in the case when the remaining data if not sufficient */
  295|  15.3k|    if (p_stream->m_status & OPJ_STREAM_STATUS_END) {
  ------------------
  |  |   75|  15.3k|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  |  Branch (295:9): [True: 0, False: 15.3k]
  ------------------
  296|      0|        l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  297|      0|        memcpy(p_buffer, p_stream->m_current_data, p_stream->m_bytes_in_buffer);
  298|      0|        p_stream->m_current_data += p_stream->m_bytes_in_buffer;
  299|      0|        p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  300|      0|        p_stream->m_bytes_in_buffer = 0;
  301|      0|        return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
  ------------------
  |  Branch (301:16): [True: 0, False: 0]
  ------------------
  302|      0|    }
  303|       |
  304|       |    /* the flag is not set, we copy data and then do an actual read on the stream */
  305|  15.3k|    if (p_stream->m_bytes_in_buffer) {
  ------------------
  |  Branch (305:9): [True: 4.10k, False: 11.2k]
  ------------------
  306|  4.10k|        l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  307|  4.10k|        memcpy(p_buffer, p_stream->m_current_data, p_stream->m_bytes_in_buffer);
  308|  4.10k|        p_stream->m_current_data = p_stream->m_stored_data;
  309|  4.10k|        p_buffer += p_stream->m_bytes_in_buffer;
  310|  4.10k|        p_size -= p_stream->m_bytes_in_buffer;
  311|  4.10k|        p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  312|  4.10k|        p_stream->m_bytes_in_buffer = 0;
  313|  11.2k|    } else {
  314|       |        /* case where we are already at the end of the buffer
  315|       |           so reset the m_current_data to point to the start of the
  316|       |           stored buffer to get ready to read from disk*/
  317|  11.2k|        p_stream->m_current_data = p_stream->m_stored_data;
  318|  11.2k|    }
  319|       |
  320|  15.3k|    for (;;) {
  321|       |        /* we should read less than a chunk -> read a chunk */
  322|  15.3k|        if (p_size < p_stream->m_buffer_size) {
  ------------------
  |  Branch (322:13): [True: 14.6k, False: 695]
  ------------------
  323|       |            /* we should do an actual read on the media */
  324|  14.6k|            p_stream->m_bytes_in_buffer = p_stream->m_read_fn(p_stream->m_stored_data,
  325|  14.6k|                                          p_stream->m_buffer_size, p_stream->m_user_data);
  326|       |
  327|  14.6k|            if (p_stream->m_bytes_in_buffer == (OPJ_SIZE_T) - 1) {
  ------------------
  |  Branch (327:17): [True: 843, False: 13.8k]
  ------------------
  328|       |                /* end of stream */
  329|    843|                opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
  ------------------
  |  |   68|    843|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  330|       |
  331|    843|                p_stream->m_bytes_in_buffer = 0;
  332|    843|                p_stream->m_status |= OPJ_STREAM_STATUS_END;
  ------------------
  |  |   75|    843|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  333|       |                /* end of stream */
  334|    843|                return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
  ------------------
  |  Branch (334:24): [True: 361, False: 482]
  ------------------
  335|  13.8k|            } else if (p_stream->m_bytes_in_buffer < p_size) {
  ------------------
  |  Branch (335:24): [True: 12, False: 13.8k]
  ------------------
  336|       |                /* not enough data */
  337|     12|                l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  338|     12|                memcpy(p_buffer, p_stream->m_current_data, p_stream->m_bytes_in_buffer);
  339|     12|                p_stream->m_current_data = p_stream->m_stored_data;
  340|     12|                p_buffer += p_stream->m_bytes_in_buffer;
  341|     12|                p_size -= p_stream->m_bytes_in_buffer;
  342|     12|                p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  343|     12|                p_stream->m_bytes_in_buffer = 0;
  344|  13.8k|            } else {
  345|  13.8k|                l_read_nb_bytes += p_size;
  346|  13.8k|                memcpy(p_buffer, p_stream->m_current_data, p_size);
  347|  13.8k|                p_stream->m_current_data += p_size;
  348|  13.8k|                p_stream->m_bytes_in_buffer -= p_size;
  349|  13.8k|                p_stream->m_byte_offset += (OPJ_OFF_T)p_size;
  350|  13.8k|                return l_read_nb_bytes;
  351|  13.8k|            }
  352|  14.6k|        } else {
  353|       |            /* direct read on the dest buffer */
  354|    695|            p_stream->m_bytes_in_buffer = p_stream->m_read_fn(p_buffer, p_size,
  355|    695|                                          p_stream->m_user_data);
  356|       |
  357|    695|            if (p_stream->m_bytes_in_buffer == (OPJ_SIZE_T) - 1) {
  ------------------
  |  Branch (357:17): [True: 73, False: 622]
  ------------------
  358|       |                /*  end of stream */
  359|     73|                opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
  ------------------
  |  |   68|     73|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  360|       |
  361|     73|                p_stream->m_bytes_in_buffer = 0;
  362|     73|                p_stream->m_status |= OPJ_STREAM_STATUS_END;
  ------------------
  |  |   75|     73|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  363|       |                /* end of stream */
  364|     73|                return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
  ------------------
  |  Branch (364:24): [True: 46, False: 27]
  ------------------
  365|    622|            } else if (p_stream->m_bytes_in_buffer < p_size) {
  ------------------
  |  Branch (365:24): [True: 11, False: 611]
  ------------------
  366|       |                /* not enough data */
  367|     11|                l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  368|     11|                p_stream->m_current_data = p_stream->m_stored_data;
  369|     11|                p_buffer += p_stream->m_bytes_in_buffer;
  370|     11|                p_size -= p_stream->m_bytes_in_buffer;
  371|     11|                p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  372|     11|                p_stream->m_bytes_in_buffer = 0;
  373|    611|            } else {
  374|       |                /* we have read the exact size */
  375|    611|                l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  376|    611|                p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  377|    611|                p_stream->m_current_data = p_stream->m_stored_data;
  378|    611|                p_stream->m_bytes_in_buffer = 0;
  379|    611|                return l_read_nb_bytes;
  380|    611|            }
  381|    695|        }
  382|  15.3k|    }
  383|  15.3k|}
opj_stream_read_skip:
  465|  3.17k|{
  466|  3.17k|    OPJ_OFF_T l_skip_nb_bytes = 0;
  467|  3.17k|    OPJ_OFF_T l_current_skip_nb_bytes = 0;
  468|       |
  469|  3.17k|    assert(p_size >= 0);
  470|       |
  471|  3.17k|    if (p_stream->m_bytes_in_buffer >= (OPJ_SIZE_T)p_size) {
  ------------------
  |  Branch (471:9): [True: 2.41k, False: 760]
  ------------------
  472|  2.41k|        p_stream->m_current_data += p_size;
  473|       |        /* it is safe to cast p_size to OPJ_SIZE_T since it is <= m_bytes_in_buffer
  474|       |        which is of type OPJ_SIZE_T */
  475|  2.41k|        p_stream->m_bytes_in_buffer -= (OPJ_SIZE_T)p_size;
  476|  2.41k|        l_skip_nb_bytes += p_size;
  477|  2.41k|        p_stream->m_byte_offset += l_skip_nb_bytes;
  478|  2.41k|        return l_skip_nb_bytes;
  479|  2.41k|    }
  480|       |
  481|       |    /* we are now in the case when the remaining data if not sufficient */
  482|    760|    if (p_stream->m_status & OPJ_STREAM_STATUS_END) {
  ------------------
  |  |   75|    760|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  |  Branch (482:9): [True: 0, False: 760]
  ------------------
  483|      0|        l_skip_nb_bytes += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  484|      0|        p_stream->m_current_data += p_stream->m_bytes_in_buffer;
  485|      0|        p_stream->m_bytes_in_buffer = 0;
  486|      0|        p_stream->m_byte_offset += l_skip_nb_bytes;
  487|      0|        return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T) - 1;
  ------------------
  |  Branch (487:16): [True: 0, False: 0]
  ------------------
  488|      0|    }
  489|       |
  490|       |    /* the flag is not set, we copy data and then do an actual skip on the stream */
  491|    760|    if (p_stream->m_bytes_in_buffer) {
  ------------------
  |  Branch (491:9): [True: 729, False: 31]
  ------------------
  492|    729|        l_skip_nb_bytes += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  493|    729|        p_stream->m_current_data = p_stream->m_stored_data;
  494|    729|        p_size -= (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  495|    729|        p_stream->m_bytes_in_buffer = 0;
  496|    729|    }
  497|       |
  498|  1.23k|    while (p_size > 0) {
  ------------------
  |  Branch (498:12): [True: 760, False: 478]
  ------------------
  499|       |        /* Check if we are going beyond the end of file. Most skip_fn do not */
  500|       |        /* check that, but we must be careful not to advance m_byte_offset */
  501|       |        /* beyond m_user_data_length, otherwise */
  502|       |        /* opj_stream_get_number_byte_left() will assert. */
  503|    760|        if ((OPJ_UINT64)(p_stream->m_byte_offset + l_skip_nb_bytes + p_size) >
  ------------------
  |  Branch (503:13): [True: 282, False: 478]
  ------------------
  504|    760|                p_stream->m_user_data_length) {
  505|    282|            opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
  ------------------
  |  |   68|    282|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  506|       |
  507|    282|            p_stream->m_byte_offset += l_skip_nb_bytes;
  508|    282|            l_skip_nb_bytes = (OPJ_OFF_T)(p_stream->m_user_data_length -
  509|    282|                                          (OPJ_UINT64)p_stream->m_byte_offset);
  510|       |
  511|    282|            opj_stream_read_seek(p_stream, (OPJ_OFF_T)p_stream->m_user_data_length,
  512|    282|                                 p_event_mgr);
  513|    282|            p_stream->m_status |= OPJ_STREAM_STATUS_END;
  ------------------
  |  |   75|    282|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  514|       |
  515|       |            /* end if stream */
  516|    282|            return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T) - 1;
  ------------------
  |  Branch (516:20): [True: 28, False: 254]
  ------------------
  517|    282|        }
  518|       |
  519|       |        /* we should do an actual skip on the media */
  520|    478|        l_current_skip_nb_bytes = p_stream->m_skip_fn(p_size, p_stream->m_user_data);
  521|    478|        if (l_current_skip_nb_bytes == (OPJ_OFF_T) - 1) {
  ------------------
  |  Branch (521:13): [True: 0, False: 478]
  ------------------
  522|      0|            opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
  ------------------
  |  |   68|      0|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  523|       |
  524|      0|            p_stream->m_status |= OPJ_STREAM_STATUS_END;
  ------------------
  |  |   75|      0|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  525|      0|            p_stream->m_byte_offset += l_skip_nb_bytes;
  526|       |            /* end if stream */
  527|      0|            return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T) - 1;
  ------------------
  |  Branch (527:20): [True: 0, False: 0]
  ------------------
  528|      0|        }
  529|    478|        p_size -= l_current_skip_nb_bytes;
  530|    478|        l_skip_nb_bytes += l_current_skip_nb_bytes;
  531|    478|    }
  532|       |
  533|    478|    p_stream->m_byte_offset += l_skip_nb_bytes;
  534|       |
  535|    478|    return l_skip_nb_bytes;
  536|    760|}
opj_stream_tell:
  580|   176k|{
  581|   176k|    return p_stream->m_byte_offset;
  582|   176k|}
opj_stream_get_number_byte_left:
  585|  49.5k|{
  586|  49.5k|    assert(p_stream->m_byte_offset >= 0);
  587|  49.5k|    assert(p_stream->m_user_data_length >= (OPJ_UINT64)p_stream->m_byte_offset);
  588|  49.5k|    return p_stream->m_user_data_length ?
  ------------------
  |  Branch (588:12): [True: 49.5k, False: 0]
  ------------------
  589|  49.5k|           (OPJ_OFF_T)(p_stream->m_user_data_length) - p_stream->m_byte_offset :
  590|  49.5k|           0;
  591|  49.5k|}
opj_stream_skip:
  595|  3.17k|{
  596|  3.17k|    assert(p_size >= 0);
  597|  3.17k|    return p_stream->m_opj_skip(p_stream, p_size, p_event_mgr);
  598|  3.17k|}
opj_stream_read_seek:
  602|    952|{
  603|    952|    OPJ_ARG_NOT_USED(p_event_mgr);
  ------------------
  |  |  144|    952|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
  604|    952|    p_stream->m_current_data = p_stream->m_stored_data;
  605|    952|    p_stream->m_bytes_in_buffer = 0;
  606|       |
  607|    952|    if (!(p_stream->m_seek_fn(p_size, p_stream->m_user_data))) {
  ------------------
  |  Branch (607:9): [True: 0, False: 952]
  ------------------
  608|      0|        p_stream->m_status |= OPJ_STREAM_STATUS_END;
  ------------------
  |  |   75|      0|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  609|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  610|    952|    } else {
  611|       |        /* reset stream status */
  612|    952|        p_stream->m_status &= (~OPJ_STREAM_STATUS_END);
  ------------------
  |  |   75|    952|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  613|    952|        p_stream->m_byte_offset = p_size;
  614|       |
  615|    952|    }
  616|       |
  617|    952|    return OPJ_TRUE;
  ------------------
  |  |  117|    952|#define OPJ_TRUE 1
  ------------------
  618|    952|}
opj_stream_seek:
  643|    670|{
  644|    670|    assert(p_size >= 0);
  645|    670|    return p_stream->m_opj_seek(p_stream, p_size, p_event_mgr);
  646|    670|}
opj_stream_has_seek:
  649|    674|{
  650|    674|    return p_stream->m_seek_fn != opj_stream_default_seek;
  651|    674|}

opj_dwt_decode:
 2125|  8.90k|{
 2126|  8.90k|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2126:9): [True: 6.02k, False: 2.88k]
  ------------------
 2127|  6.02k|        return opj_dwt_decode_tile(p_tcd->thread_pool, tilec, numres);
 2128|  6.02k|    } else {
 2129|  2.88k|        return opj_dwt_decode_partial_tile(tilec, numres);
 2130|  2.88k|    }
 2131|  8.90k|}
opj_dwt_decode_real:
 3973|  3.36k|{
 3974|  3.36k|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (3974:9): [True: 1.55k, False: 1.81k]
  ------------------
 3975|  1.55k|        return opj_dwt_decode_tile_97(p_tcd->thread_pool, tilec, numres);
 3976|  1.81k|    } else {
 3977|  1.81k|        return opj_dwt_decode_partial_97(tilec, numres);
 3978|  1.81k|    }
 3979|  3.36k|}
dwt.c:opj_dwt_max_resolution:
 2205|  6.85k|{
 2206|  6.85k|    OPJ_UINT32 mr   = 0;
 2207|  6.85k|    OPJ_UINT32 w;
 2208|   108k|    while (--i) {
  ------------------
  |  Branch (2208:12): [True: 102k, False: 6.85k]
  ------------------
 2209|   102k|        ++r;
 2210|   102k|        if (mr < (w = (OPJ_UINT32)(r->x1 - r->x0))) {
  ------------------
  |  Branch (2210:13): [True: 19.6k, False: 82.4k]
  ------------------
 2211|  19.6k|            mr = w ;
 2212|  19.6k|        }
 2213|   102k|        if (mr < (w = (OPJ_UINT32)(r->y1 - r->y0))) {
  ------------------
  |  Branch (2213:13): [True: 29.7k, False: 72.4k]
  ------------------
 2214|  29.7k|            mr = w ;
 2215|  29.7k|        }
 2216|   102k|    }
 2217|  6.85k|    return mr ;
 2218|  6.85k|}
dwt.c:opj_dwt_decode_tile:
 2279|  6.02k|{
 2280|  6.02k|    opj_dwt_t h;
 2281|  6.02k|    opj_dwt_t v;
 2282|       |
 2283|  6.02k|    opj_tcd_resolution_t* tr = tilec->resolutions;
 2284|       |
 2285|  6.02k|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 2286|  6.02k|                                 tr->x0);  /* width of the resolution level computed */
 2287|  6.02k|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 2288|  6.02k|                                 tr->y0);  /* height of the resolution level computed */
 2289|       |
 2290|  6.02k|    OPJ_UINT32 w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions -
 2291|  6.02k|                                                               1].x1 -
 2292|  6.02k|                                tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 2293|  6.02k|    OPJ_SIZE_T h_mem_size;
 2294|  6.02k|    int num_threads;
 2295|       |
 2296|       |    /* Not entirely sure for the return code of w == 0 which is triggered per */
 2297|       |    /* https://github.com/uclouvain/openjpeg/issues/1505 */
 2298|  6.02k|    if (numres == 1U || w == 0) {
  ------------------
  |  Branch (2298:9): [True: 2.36k, False: 3.66k]
  |  Branch (2298:25): [True: 0, False: 3.66k]
  ------------------
 2299|  2.36k|        return OPJ_TRUE;
  ------------------
  |  |  117|  2.36k|#define OPJ_TRUE 1
  ------------------
 2300|  2.36k|    }
 2301|  3.66k|    num_threads = opj_thread_pool_get_thread_count(tp);
 2302|  3.66k|    h_mem_size = opj_dwt_max_resolution(tr, numres);
 2303|       |    /* overflow check */
 2304|  3.66k|    if (h_mem_size > (SIZE_MAX / PARALLEL_COLS_53 / sizeof(OPJ_INT32))) {
  ------------------
  |  |   81|  3.66k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|  3.66k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (2304:9): [True: 0, False: 3.66k]
  ------------------
 2305|       |        /* FIXME event manager error callback */
 2306|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2307|      0|    }
 2308|       |    /* We need PARALLEL_COLS_53 times the height of the array, */
 2309|       |    /* since for the vertical pass */
 2310|       |    /* we process PARALLEL_COLS_53 columns at a time */
 2311|  3.66k|    h_mem_size *= PARALLEL_COLS_53 * sizeof(OPJ_INT32);
  ------------------
  |  |   81|  3.66k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|  3.66k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2312|  3.66k|    h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2313|  3.66k|    if (! h.mem) {
  ------------------
  |  Branch (2313:9): [True: 0, False: 3.66k]
  ------------------
 2314|       |        /* FIXME event manager error callback */
 2315|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2316|      0|    }
 2317|       |
 2318|  3.66k|    v.mem = h.mem;
 2319|       |
 2320|  67.8k|    while (--numres) {
  ------------------
  |  Branch (2320:12): [True: 64.2k, False: 3.66k]
  ------------------
 2321|  64.2k|        OPJ_INT32 * OPJ_RESTRICT tiledp = tilec->data;
 2322|  64.2k|        OPJ_UINT32 j;
 2323|       |
 2324|  64.2k|        ++tr;
 2325|  64.2k|        h.sn = (OPJ_INT32)rw;
 2326|  64.2k|        v.sn = (OPJ_INT32)rh;
 2327|       |
 2328|  64.2k|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 2329|  64.2k|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 2330|       |
 2331|  64.2k|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 2332|  64.2k|        h.cas = tr->x0 % 2;
 2333|       |
 2334|  64.2k|        if (num_threads <= 1 || rh <= 1) {
  ------------------
  |  Branch (2334:13): [True: 64.2k, False: 0]
  |  Branch (2334:33): [True: 0, False: 0]
  ------------------
 2335|   819k|            for (j = 0; j < rh; ++j) {
  ------------------
  |  Branch (2335:25): [True: 754k, False: 64.2k]
  ------------------
 2336|   754k|                opj_idwt53_h(&h, &tiledp[(OPJ_SIZE_T)j * w]);
 2337|   754k|            }
 2338|  64.2k|        } else {
 2339|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 2340|      0|            OPJ_UINT32 step_j;
 2341|       |
 2342|      0|            if (rh < num_jobs) {
  ------------------
  |  Branch (2342:17): [True: 0, False: 0]
  ------------------
 2343|      0|                num_jobs = rh;
 2344|      0|            }
 2345|      0|            step_j = (rh / num_jobs);
 2346|       |
 2347|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (2347:25): [True: 0, False: 0]
  ------------------
 2348|      0|                opj_dwt_decode_h_job_t* job;
 2349|       |
 2350|      0|                job = (opj_dwt_decode_h_job_t*) opj_malloc(sizeof(opj_dwt_decode_h_job_t));
 2351|      0|                if (!job) {
  ------------------
  |  Branch (2351:21): [True: 0, False: 0]
  ------------------
 2352|       |                    /* It would be nice to fallback to single thread case, but */
 2353|       |                    /* unfortunately some jobs may be launched and have modified */
 2354|       |                    /* tiledp, so it is not practical to recover from that error */
 2355|       |                    /* FIXME event manager error callback */
 2356|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2357|      0|                    opj_aligned_free(h.mem);
 2358|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2359|      0|                }
 2360|      0|                job->h = h;
 2361|      0|                job->rw = rw;
 2362|      0|                job->w = w;
 2363|      0|                job->tiledp = tiledp;
 2364|      0|                job->min_j = j * step_j;
 2365|      0|                job->max_j = (j + 1U) * step_j; /* this can overflow */
 2366|      0|                if (j == (num_jobs - 1U)) {  /* this will take care of the overflow */
  ------------------
  |  Branch (2366:21): [True: 0, False: 0]
  ------------------
 2367|      0|                    job->max_j = rh;
 2368|      0|                }
 2369|      0|                job->h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2370|      0|                if (!job->h.mem) {
  ------------------
  |  Branch (2370:21): [True: 0, False: 0]
  ------------------
 2371|       |                    /* FIXME event manager error callback */
 2372|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2373|      0|                    opj_free(job);
 2374|      0|                    opj_aligned_free(h.mem);
 2375|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2376|      0|                }
 2377|      0|                opj_thread_pool_submit_job(tp, opj_dwt_decode_h_func, job);
 2378|      0|            }
 2379|      0|            opj_thread_pool_wait_completion(tp, 0);
 2380|      0|        }
 2381|       |
 2382|  64.2k|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 2383|  64.2k|        v.cas = tr->y0 % 2;
 2384|       |
 2385|  64.2k|        if (num_threads <= 1 || rw <= 1) {
  ------------------
  |  Branch (2385:13): [True: 64.2k, False: 0]
  |  Branch (2385:33): [True: 0, False: 0]
  ------------------
 2386|   130k|            for (j = 0; j + PARALLEL_COLS_53 <= rw;
  ------------------
  |  |   81|   130k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|   130k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (2386:25): [True: 66.7k, False: 64.2k]
  ------------------
 2387|  66.7k|                    j += PARALLEL_COLS_53) {
  ------------------
  |  |   81|  66.7k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|  66.7k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2388|  66.7k|                opj_idwt53_v(&v, &tiledp[j], (OPJ_SIZE_T)w, PARALLEL_COLS_53);
  ------------------
  |  |   81|  66.7k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|  66.7k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2389|  66.7k|            }
 2390|  64.2k|            if (j < rw) {
  ------------------
  |  Branch (2390:17): [True: 15.5k, False: 48.6k]
  ------------------
 2391|  15.5k|                opj_idwt53_v(&v, &tiledp[j], (OPJ_SIZE_T)w, (OPJ_INT32)(rw - j));
 2392|  15.5k|            }
 2393|  64.2k|        } else {
 2394|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 2395|      0|            OPJ_UINT32 step_j;
 2396|       |
 2397|      0|            if (rw < num_jobs) {
  ------------------
  |  Branch (2397:17): [True: 0, False: 0]
  ------------------
 2398|      0|                num_jobs = rw;
 2399|      0|            }
 2400|      0|            step_j = (rw / num_jobs);
 2401|       |
 2402|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (2402:25): [True: 0, False: 0]
  ------------------
 2403|      0|                opj_dwt_decode_v_job_t* job;
 2404|       |
 2405|      0|                job = (opj_dwt_decode_v_job_t*) opj_malloc(sizeof(opj_dwt_decode_v_job_t));
 2406|      0|                if (!job) {
  ------------------
  |  Branch (2406:21): [True: 0, False: 0]
  ------------------
 2407|       |                    /* It would be nice to fallback to single thread case, but */
 2408|       |                    /* unfortunately some jobs may be launched and have modified */
 2409|       |                    /* tiledp, so it is not practical to recover from that error */
 2410|       |                    /* FIXME event manager error callback */
 2411|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2412|      0|                    opj_aligned_free(v.mem);
 2413|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2414|      0|                }
 2415|      0|                job->v = v;
 2416|      0|                job->rh = rh;
 2417|      0|                job->w = w;
 2418|      0|                job->tiledp = tiledp;
 2419|      0|                job->min_j = j * step_j;
 2420|      0|                job->max_j = (j + 1U) * step_j; /* this can overflow */
 2421|      0|                if (j == (num_jobs - 1U)) {  /* this will take care of the overflow */
  ------------------
  |  Branch (2421:21): [True: 0, False: 0]
  ------------------
 2422|      0|                    job->max_j = rw;
 2423|      0|                }
 2424|      0|                job->v.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2425|      0|                if (!job->v.mem) {
  ------------------
  |  Branch (2425:21): [True: 0, False: 0]
  ------------------
 2426|       |                    /* FIXME event manager error callback */
 2427|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2428|      0|                    opj_free(job);
 2429|      0|                    opj_aligned_free(v.mem);
 2430|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2431|      0|                }
 2432|      0|                opj_thread_pool_submit_job(tp, opj_dwt_decode_v_func, job);
 2433|      0|            }
 2434|      0|            opj_thread_pool_wait_completion(tp, 0);
 2435|      0|        }
 2436|  64.2k|    }
 2437|  3.66k|    opj_aligned_free(h.mem);
 2438|  3.66k|    return OPJ_TRUE;
  ------------------
  |  |  117|  3.66k|#define OPJ_TRUE 1
  ------------------
 2439|  3.66k|}
dwt.c:opj_idwt53_h:
  670|   754k|{
  671|       |#ifdef STANDARD_SLOW_VERSION
  672|       |    /* For documentation purpose */
  673|       |    opj_dwt_interleave_h(dwt, tiledp);
  674|       |    opj_dwt_decode_1(dwt);
  675|       |    memcpy(tiledp, dwt->mem, (OPJ_UINT32)(dwt->sn + dwt->dn) * sizeof(OPJ_INT32));
  676|       |#else
  677|   754k|    const OPJ_INT32 sn = dwt->sn;
  678|   754k|    const OPJ_INT32 len = sn + dwt->dn;
  679|   754k|    if (dwt->cas == 0) { /* Left-most sample is on even coordinate */
  ------------------
  |  Branch (679:9): [True: 348k, False: 406k]
  ------------------
  680|   348k|        if (len > 1) {
  ------------------
  |  Branch (680:13): [True: 220k, False: 127k]
  ------------------
  681|   220k|            opj_idwt53_h_cas0(dwt->mem, sn, len, tiledp);
  682|   220k|        } else {
  683|       |            /* Unmodified value */
  684|   127k|        }
  685|   406k|    } else { /* Left-most sample is on odd coordinate */
  686|   406k|        if (len == 1) {
  ------------------
  |  Branch (686:13): [True: 8.26k, False: 398k]
  ------------------
  687|  8.26k|            tiledp[0] /= 2;
  688|   398k|        } else if (len == 2) {
  ------------------
  |  Branch (688:20): [True: 1.48k, False: 396k]
  ------------------
  689|  1.48k|            OPJ_INT32* out = dwt->mem;
  690|  1.48k|            const OPJ_INT32* in_even = &tiledp[sn];
  691|  1.48k|            const OPJ_INT32* in_odd = &tiledp[0];
  692|  1.48k|            out[1] = in_odd[0] - ((in_even[0] + 1) >> 1);
  693|  1.48k|            out[0] = in_even[0] + out[1];
  694|  1.48k|            memcpy(tiledp, dwt->mem, (OPJ_UINT32)len * sizeof(OPJ_INT32));
  695|   396k|        } else if (len > 2) {
  ------------------
  |  Branch (695:20): [True: 384k, False: 12.7k]
  ------------------
  696|   384k|            opj_idwt53_h_cas1(dwt->mem, sn, len, tiledp);
  697|   384k|        }
  698|   406k|    }
  699|   754k|#endif
  700|   754k|}
dwt.c:opj_idwt53_h_cas0:
  387|   220k|{
  388|   220k|    OPJ_INT32 i, j;
  389|   220k|    const OPJ_INT32* in_even = &tiledp[0];
  390|   220k|    const OPJ_INT32* in_odd = &tiledp[sn];
  391|       |
  392|       |#ifdef TWO_PASS_VERSION
  393|       |    /* For documentation purpose: performs lifting in two iterations, */
  394|       |    /* but without explicit interleaving */
  395|       |
  396|       |    assert(len > 1);
  397|       |
  398|       |    /* Even */
  399|       |    tmp[0] = in_even[0] - ((in_odd[0] + 1) >> 1);
  400|       |    for (i = 2, j = 0; i <= len - 2; i += 2, j++) {
  401|       |        tmp[i] = in_even[j + 1] - ((in_odd[j] + in_odd[j + 1] + 2) >> 2);
  402|       |    }
  403|       |    if (len & 1) { /* if len is odd */
  404|       |        tmp[len - 1] = in_even[(len - 1) / 2] - ((in_odd[(len - 2) / 2] + 1) >> 1);
  405|       |    }
  406|       |
  407|       |    /* Odd */
  408|       |    for (i = 1, j = 0; i < len - 1; i += 2, j++) {
  409|       |        tmp[i] = in_odd[j] + ((tmp[i - 1] + tmp[i + 1]) >> 1);
  410|       |    }
  411|       |    if (!(len & 1)) { /* if len is even */
  412|       |        tmp[len - 1] = in_odd[(len - 1) / 2] + tmp[len - 2];
  413|       |    }
  414|       |#else
  415|       |#if defined(__AVX512F__)
  416|       |    OPJ_INT32* out_ptr = tmp;
  417|       |    int32_t prev_even = in_even[0] - ((in_odd[0] + 1) >> 1);
  418|       |
  419|       |    const __m512i permutevar_mask = _mm512_setr_epi32(
  420|       |                                        0x10, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
  421|       |                                        0x0c, 0x0d, 0x0e);
  422|       |    const __m512i store1_perm = _mm512_setr_epi64(0x00, 0x01, 0x08, 0x09, 0x02,
  423|       |                                0x03, 0x0a, 0x0b);
  424|       |    const __m512i store2_perm = _mm512_setr_epi64(0x04, 0x05, 0x0c, 0x0d, 0x06,
  425|       |                                0x07, 0x0e, 0x0f);
  426|       |
  427|       |    const __m512i two = _mm512_set1_epi32(2);
  428|       |
  429|       |    int32_t simd_batch_512 = (len - 2) / 32;
  430|       |    int32_t leftover;
  431|       |
  432|       |    for (i = 0; i < simd_batch_512; i++) {
  433|       |        const __m512i lf_avx2 = _mm512_loadu_si512((__m512i*)(in_even + 1));
  434|       |        const __m512i hf1_avx2 = _mm512_loadu_si512((__m512i*)(in_odd));
  435|       |        const __m512i hf2_avx2 = _mm512_loadu_si512((__m512i*)(in_odd + 1));
  436|       |        int32_t next_even;
  437|       |        __m512i duplicate, even_m1, odd, unpack1, unpack2, store1, store2;
  438|       |
  439|       |        __m512i even = _mm512_add_epi32(hf1_avx2, hf2_avx2);
  440|       |        even = _mm512_add_epi32(even, two);
  441|       |        even = _mm512_srai_epi32(even, 2);
  442|       |        even = _mm512_sub_epi32(lf_avx2, even);
  443|       |
  444|       |        next_even = _mm_extract_epi32(_mm512_extracti32x4_epi32(even, 3), 3);
  445|       |
  446|       |        duplicate = _mm512_set1_epi32(prev_even);
  447|       |        even_m1 = _mm512_permutex2var_epi32(even, permutevar_mask, duplicate);
  448|       |
  449|       |        //out[0] + out[2]
  450|       |        odd = _mm512_add_epi32(even_m1, even);
  451|       |        odd = _mm512_srai_epi32(odd, 1);
  452|       |        odd = _mm512_add_epi32(odd, hf1_avx2);
  453|       |
  454|       |        unpack1 = _mm512_unpacklo_epi32(even_m1, odd);
  455|       |        unpack2 = _mm512_unpackhi_epi32(even_m1, odd);
  456|       |
  457|       |        store1 = _mm512_permutex2var_epi64(unpack1, store1_perm, unpack2);
  458|       |        store2 = _mm512_permutex2var_epi64(unpack1, store2_perm, unpack2);
  459|       |
  460|       |        _mm512_storeu_si512(out_ptr, store1);
  461|       |        _mm512_storeu_si512(out_ptr + 16, store2);
  462|       |
  463|       |        prev_even = next_even;
  464|       |
  465|       |        out_ptr += 32;
  466|       |        in_even += 16;
  467|       |        in_odd += 16;
  468|       |    }
  469|       |
  470|       |    leftover = len - simd_batch_512 * 32;
  471|       |    if (leftover > 8) {
  472|       |        leftover -= 8 * loop_short_sse(leftover, &in_even, &in_odd, &out_ptr,
  473|       |                                       &prev_even);
  474|       |    }
  475|       |    out_ptr[0] = prev_even;
  476|       |
  477|       |    for (j = 1; j < (leftover - 2); j += 2) {
  478|       |        out_ptr[2] = in_even[1] - ((in_odd[0] + (in_odd[1]) + 2) >> 2);
  479|       |        out_ptr[1] = in_odd[0] + ((out_ptr[0] + out_ptr[2]) >> 1);
  480|       |        in_even++;
  481|       |        in_odd++;
  482|       |        out_ptr += 2;
  483|       |    }
  484|       |
  485|       |    if (len & 1) {
  486|       |        out_ptr[2] = in_even[1] - ((in_odd[0] + 1) >> 1);
  487|       |        out_ptr[1] = in_odd[0] + ((out_ptr[0] + out_ptr[2]) >> 1);
  488|       |    } else { //!(len & 1)
  489|       |        out_ptr[1] = in_odd[0] + out_ptr[0];
  490|       |    }
  491|       |#elif  defined(__AVX2__)
  492|       |    OPJ_INT32* out_ptr = tmp;
  493|       |    int32_t prev_even = in_even[0] - ((in_odd[0] + 1) >> 1);
  494|       |
  495|       |    const __m256i reg_permutevar_mask_move_right = _mm256_setr_epi32(0x00, 0x00,
  496|       |            0x01, 0x02, 0x03, 0x04, 0x05, 0x06);
  497|       |    const __m256i two = _mm256_set1_epi32(2);
  498|       |
  499|       |    int32_t simd_batch = (len - 2) / 16;
  500|       |    int32_t next_even;
  501|       |    __m256i even_m1, odd, unpack1_avx2, unpack2_avx2;
  502|       |
  503|       |    for (i = 0; i < simd_batch; i++) {
  504|       |        const __m256i lf_avx2 = _mm256_loadu_si256((__m256i*)(in_even + 1));
  505|       |        const __m256i hf1_avx2 = _mm256_loadu_si256((__m256i*)(in_odd));
  506|       |        const __m256i hf2_avx2 = _mm256_loadu_si256((__m256i*)(in_odd + 1));
  507|       |
  508|       |        __m256i even = _mm256_add_epi32(hf1_avx2, hf2_avx2);
  509|       |        even = _mm256_add_epi32(even, two);
  510|       |        even = _mm256_srai_epi32(even, 2);
  511|       |        even = _mm256_sub_epi32(lf_avx2, even);
  512|       |
  513|       |        next_even = _mm_extract_epi32(_mm256_extracti128_si256(even, 1), 3);
  514|       |        even_m1 = _mm256_permutevar8x32_epi32(even, reg_permutevar_mask_move_right);
  515|       |        even_m1 = _mm256_blend_epi32(even_m1, _mm256_set1_epi32(prev_even), (1 << 0));
  516|       |
  517|       |        //out[0] + out[2]
  518|       |        odd = _mm256_add_epi32(even_m1, even);
  519|       |        odd = _mm256_srai_epi32(odd, 1);
  520|       |        odd = _mm256_add_epi32(odd, hf1_avx2);
  521|       |
  522|       |        unpack1_avx2 = _mm256_unpacklo_epi32(even_m1, odd);
  523|       |        unpack2_avx2 = _mm256_unpackhi_epi32(even_m1, odd);
  524|       |
  525|       |        _mm_storeu_si128((__m128i*)(out_ptr + 0), _mm256_castsi256_si128(unpack1_avx2));
  526|       |        _mm_storeu_si128((__m128i*)(out_ptr + 4), _mm256_castsi256_si128(unpack2_avx2));
  527|       |        _mm_storeu_si128((__m128i*)(out_ptr + 8), _mm256_extracti128_si256(unpack1_avx2,
  528|       |                         0x1));
  529|       |        _mm_storeu_si128((__m128i*)(out_ptr + 12),
  530|       |                         _mm256_extracti128_si256(unpack2_avx2, 0x1));
  531|       |
  532|       |        prev_even = next_even;
  533|       |
  534|       |        out_ptr += 16;
  535|       |        in_even += 8;
  536|       |        in_odd += 8;
  537|       |    }
  538|       |    out_ptr[0] = prev_even;
  539|       |    for (j = simd_batch * 16 + 1; j < (len - 2); j += 2) {
  540|       |        out_ptr[2] = in_even[1] - ((in_odd[0] + in_odd[1] + 2) >> 2);
  541|       |        out_ptr[1] = in_odd[0] + ((out_ptr[0] + out_ptr[2]) >> 1);
  542|       |        in_even++;
  543|       |        in_odd++;
  544|       |        out_ptr += 2;
  545|       |    }
  546|       |
  547|       |    if (len & 1) {
  548|       |        out_ptr[2] = in_even[1] - ((in_odd[0] + 1) >> 1);
  549|       |        out_ptr[1] = in_odd[0] + ((out_ptr[0] + out_ptr[2]) >> 1);
  550|       |    } else { //!(len & 1)
  551|       |        out_ptr[1] = in_odd[0] + out_ptr[0];
  552|       |    }
  553|       |#else
  554|   220k|    OPJ_INT32 d1c, d1n, s1n, s0c, s0n;
  555|       |
  556|   220k|    assert(len > 1);
  557|       |
  558|       |    /* Improved version of the TWO_PASS_VERSION: */
  559|       |    /* Performs lifting in one single iteration. Saves memory */
  560|       |    /* accesses and explicit interleaving. */
  561|   220k|    s1n = in_even[0];
  562|   220k|    d1n = in_odd[0];
  563|   220k|    s0n = s1n - ((d1n + 1) >> 1);
  564|       |
  565|  9.78M|    for (i = 0, j = 1; i < (len - 3); i += 2, j++) {
  ------------------
  |  Branch (565:24): [True: 9.56M, False: 220k]
  ------------------
  566|  9.56M|        d1c = d1n;
  567|  9.56M|        s0c = s0n;
  568|       |
  569|  9.56M|        s1n = in_even[j];
  570|  9.56M|        d1n = in_odd[j];
  571|       |
  572|  9.56M|        s0n = s1n - ((d1c + d1n + 2) >> 2);
  573|       |
  574|  9.56M|        tmp[i  ] = s0c;
  575|  9.56M|        tmp[i + 1] = opj_int_add_no_overflow(d1c, opj_int_add_no_overflow(s0c,
  576|  9.56M|                                             s0n) >> 1);
  577|  9.56M|    }
  578|       |
  579|   220k|    tmp[i] = s0n;
  580|       |
  581|   220k|    if (len & 1) {
  ------------------
  |  Branch (581:9): [True: 27.0k, False: 193k]
  ------------------
  582|  27.0k|        tmp[len - 1] = in_even[(len - 1) / 2] - ((d1n + 1) >> 1);
  583|  27.0k|        tmp[len - 2] = d1n + ((s0n + tmp[len - 1]) >> 1);
  584|   193k|    } else {
  585|   193k|        tmp[len - 1] = d1n + s0n;
  586|   193k|    }
  587|   220k|#endif /*(__AVX512F__ || __AVX2__)*/
  588|   220k|#endif /*TWO_PASS_VERSION*/
  589|   220k|    memcpy(tiledp, tmp, (OPJ_UINT32)len * sizeof(OPJ_INT32));
  590|   220k|}
dwt.c:opj_idwt53_h_cas1:
  596|   384k|{
  597|   384k|    OPJ_INT32 i, j;
  598|   384k|    const OPJ_INT32* in_even = &tiledp[sn];
  599|   384k|    const OPJ_INT32* in_odd = &tiledp[0];
  600|       |
  601|       |#ifdef TWO_PASS_VERSION
  602|       |    /* For documentation purpose: performs lifting in two iterations, */
  603|       |    /* but without explicit interleaving */
  604|       |
  605|       |    assert(len > 2);
  606|       |
  607|       |    /* Odd */
  608|       |    for (i = 1, j = 0; i < len - 1; i += 2, j++) {
  609|       |        tmp[i] = in_odd[j] - ((in_even[j] + in_even[j + 1] + 2) >> 2);
  610|       |    }
  611|       |    if (!(len & 1)) {
  612|       |        tmp[len - 1] = in_odd[len / 2 - 1] - ((in_even[len / 2 - 1] + 1) >> 1);
  613|       |    }
  614|       |
  615|       |    /* Even */
  616|       |    tmp[0] = in_even[0] + tmp[1];
  617|       |    for (i = 2, j = 1; i < len - 1; i += 2, j++) {
  618|       |        tmp[i] = in_even[j] + ((tmp[i + 1] + tmp[i - 1]) >> 1);
  619|       |    }
  620|       |    if (len & 1) {
  621|       |        tmp[len - 1] = in_even[len / 2] + tmp[len - 2];
  622|       |    }
  623|       |#else
  624|   384k|    OPJ_INT32 s1, s2, dc, dn;
  625|       |
  626|   384k|    assert(len > 2);
  627|       |
  628|       |    /* Improved version of the TWO_PASS_VERSION: */
  629|       |    /* Performs lifting in one single iteration. Saves memory */
  630|       |    /* accesses and explicit interleaving. */
  631|       |
  632|   384k|    s1 = in_even[1];
  633|   384k|    dc = in_odd[0] - ((in_even[0] + s1 + 2) >> 2);
  634|   384k|    tmp[0] = in_even[0] + dc;
  635|       |
  636|  16.4M|    for (i = 1, j = 1; i < (len - 2 - !(len & 1)); i += 2, j++) {
  ------------------
  |  Branch (636:24): [True: 16.0M, False: 384k]
  ------------------
  637|       |
  638|  16.0M|        s2 = in_even[j + 1];
  639|       |
  640|  16.0M|        dn = in_odd[j] - ((s1 + s2 + 2) >> 2);
  641|  16.0M|        tmp[i  ] = dc;
  642|  16.0M|        tmp[i + 1] = opj_int_add_no_overflow(s1, opj_int_add_no_overflow(dn, dc) >> 1);
  643|       |
  644|  16.0M|        dc = dn;
  645|  16.0M|        s1 = s2;
  646|  16.0M|    }
  647|       |
  648|   384k|    tmp[i] = dc;
  649|       |
  650|   384k|    if (!(len & 1)) {
  ------------------
  |  Branch (650:9): [True: 145k, False: 238k]
  ------------------
  651|   145k|        dn = in_odd[len / 2 - 1] - ((s1 + 1) >> 1);
  652|   145k|        tmp[len - 2] = s1 + ((dn + dc) >> 1);
  653|   145k|        tmp[len - 1] = dn;
  654|   238k|    } else {
  655|   238k|        tmp[len - 1] = s1 + dc;
  656|   238k|    }
  657|   384k|#endif
  658|   384k|    memcpy(tiledp, tmp, (OPJ_UINT32)len * sizeof(OPJ_INT32));
  659|   384k|}
dwt.c:opj_idwt53_v:
 1090|  82.3k|{
 1091|       |#ifdef STANDARD_SLOW_VERSION
 1092|       |    /* For documentation purpose */
 1093|       |    OPJ_INT32 k, c;
 1094|       |    for (c = 0; c < nb_cols; c ++) {
 1095|       |        opj_dwt_interleave_v(dwt, tiledp_col + c, stride);
 1096|       |        opj_dwt_decode_1(dwt);
 1097|       |        for (k = 0; k < dwt->sn + dwt->dn; ++k) {
 1098|       |            tiledp_col[c + k * stride] = dwt->mem[k];
 1099|       |        }
 1100|       |    }
 1101|       |#else
 1102|  82.3k|    const OPJ_INT32 sn = dwt->sn;
 1103|  82.3k|    const OPJ_INT32 len = sn + dwt->dn;
 1104|  82.3k|    if (dwt->cas == 0) {
  ------------------
  |  Branch (1104:9): [True: 60.5k, False: 21.7k]
  ------------------
 1105|       |        /* If len == 1, unmodified value */
 1106|       |
 1107|  60.5k|#if (defined(__SSE2__) || defined(__AVX2__))
 1108|  60.5k|        if (len > 1 && nb_cols == PARALLEL_COLS_53) {
  ------------------
  |  |   81|  58.6k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|  58.6k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (1108:13): [True: 58.6k, False: 1.95k]
  |  Branch (1108:24): [True: 51.7k, False: 6.90k]
  ------------------
 1109|       |            /* Same as below general case, except that thanks to SSE2/AVX2 */
 1110|       |            /* we can efficiently process 8/16 columns in parallel */
 1111|  51.7k|            opj_idwt53_v_cas0_mcols_SSE2_OR_AVX2(dwt->mem, sn, len, tiledp_col, stride);
 1112|  51.7k|            return;
 1113|  51.7k|        }
 1114|  8.85k|#endif
 1115|  8.85k|        if (len > 1) {
  ------------------
  |  Branch (1115:13): [True: 6.90k, False: 1.95k]
  ------------------
 1116|  6.90k|            OPJ_INT32 c;
 1117|  28.7k|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (1117:25): [True: 21.8k, False: 6.90k]
  ------------------
 1118|  21.8k|                opj_idwt3_v_cas0(dwt->mem, sn, len, tiledp_col, stride);
 1119|  21.8k|            }
 1120|  6.90k|            return;
 1121|  6.90k|        }
 1122|  21.7k|    } else {
 1123|  21.7k|        if (len == 1) {
  ------------------
  |  Branch (1123:13): [True: 2.14k, False: 19.5k]
  ------------------
 1124|  2.14k|            OPJ_INT32 c;
 1125|  11.8k|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (1125:25): [True: 9.67k, False: 2.14k]
  ------------------
 1126|  9.67k|                tiledp_col[0] /= 2;
 1127|  9.67k|            }
 1128|  2.14k|            return;
 1129|  2.14k|        }
 1130|       |
 1131|  19.5k|        if (len == 2) {
  ------------------
  |  Branch (1131:13): [True: 581, False: 19.0k]
  ------------------
 1132|    581|            OPJ_INT32 c;
 1133|    581|            OPJ_INT32* out = dwt->mem;
 1134|  3.19k|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (1134:25): [True: 2.61k, False: 581]
  ------------------
 1135|  2.61k|                OPJ_INT32 i;
 1136|  2.61k|                const OPJ_INT32* in_even = &tiledp_col[(OPJ_SIZE_T)sn * stride];
 1137|  2.61k|                const OPJ_INT32* in_odd = &tiledp_col[0];
 1138|       |
 1139|  2.61k|                out[1] = in_odd[0] - ((in_even[0] + 1) >> 1);
 1140|  2.61k|                out[0] = in_even[0] + out[1];
 1141|       |
 1142|  7.83k|                for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (1142:29): [True: 5.22k, False: 2.61k]
  ------------------
 1143|  5.22k|                    tiledp_col[(OPJ_SIZE_T)i * stride] = out[i];
 1144|  5.22k|                }
 1145|  2.61k|            }
 1146|       |
 1147|    581|            return;
 1148|    581|        }
 1149|       |
 1150|  19.0k|#if (defined(__SSE2__) || defined(__AVX2__))
 1151|  19.0k|        if (len > 2 && nb_cols == PARALLEL_COLS_53) {
  ------------------
  |  |   81|  17.7k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|  17.7k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (1151:13): [True: 17.7k, False: 1.23k]
  |  Branch (1151:24): [True: 12.9k, False: 4.80k]
  ------------------
 1152|       |            /* Same as below general case, except that thanks to SSE2/AVX2 */
 1153|       |            /* we can efficiently process 8/16 columns in parallel */
 1154|  12.9k|            opj_idwt53_v_cas1_mcols_SSE2_OR_AVX2(dwt->mem, sn, len, tiledp_col, stride);
 1155|  12.9k|            return;
 1156|  12.9k|        }
 1157|  6.03k|#endif
 1158|  6.03k|        if (len > 2) {
  ------------------
  |  Branch (1158:13): [True: 4.80k, False: 1.23k]
  ------------------
 1159|  4.80k|            OPJ_INT32 c;
 1160|  19.3k|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (1160:25): [True: 14.5k, False: 4.80k]
  ------------------
 1161|  14.5k|                opj_idwt3_v_cas1(dwt->mem, sn, len, tiledp_col, stride);
 1162|  14.5k|            }
 1163|  4.80k|            return;
 1164|  4.80k|        }
 1165|  6.03k|    }
 1166|  82.3k|#endif
 1167|  82.3k|}
dwt.c:opj_idwt53_v_cas0_mcols_SSE2_OR_AVX2:
  766|  51.7k|{
  767|  51.7k|    const OPJ_INT32* in_even = &tiledp_col[0];
  768|  51.7k|    const OPJ_INT32* in_odd = &tiledp_col[(OPJ_SIZE_T)sn * stride];
  769|       |
  770|  51.7k|    OPJ_INT32 i;
  771|  51.7k|    OPJ_SIZE_T j;
  772|  51.7k|    VREG d1c_0, d1n_0, s1n_0, s0c_0, s0n_0;
  ------------------
  |  |  726|  51.7k|#define VREG        __m128i
  ------------------
  773|  51.7k|    VREG d1c_1, d1n_1, s1n_1, s0c_1, s0n_1;
  ------------------
  |  |  726|  51.7k|#define VREG        __m128i
  ------------------
  774|  51.7k|    const VREG two = LOAD_CST(2);
  ------------------
  |  |  727|  51.7k|#define LOAD_CST(x) _mm_set1_epi32(x)
  ------------------
  775|       |
  776|  51.7k|    assert(len > 1);
  777|       |#if defined(__AVX512F__)
  778|       |    assert(PARALLEL_COLS_53 == 32);
  779|       |    assert(VREG_INT_COUNT == 16);
  780|       |#elif defined(__AVX2__)
  781|       |    assert(PARALLEL_COLS_53 == 16);
  782|       |    assert(VREG_INT_COUNT == 8);
  783|       |#else
  784|  51.7k|    assert(PARALLEL_COLS_53 == 8);
  785|  51.7k|    assert(VREG_INT_COUNT == 4);
  786|  51.7k|#endif
  787|       |
  788|       |//For AVX512 code aligned load/store is set to it's unaligned equivalents
  789|  51.7k|#if !defined(__AVX512F__)
  790|       |    /* Note: loads of input even/odd values must be done in a unaligned */
  791|       |    /* fashion. But stores in tmp can be done with aligned store, since */
  792|       |    /* the temporary buffer is properly aligned */
  793|  51.7k|    assert((OPJ_SIZE_T)tmp % (sizeof(OPJ_INT32) * VREG_INT_COUNT) == 0);
  794|  51.7k|#endif
  795|       |
  796|  51.7k|    s1n_0 = LOADU(in_even + 0);
  ------------------
  |  |  729|  51.7k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  797|  51.7k|    s1n_1 = LOADU(in_even + VREG_INT_COUNT);
  ------------------
  |  |  729|  51.7k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  798|  51.7k|    d1n_0 = LOADU(in_odd);
  ------------------
  |  |  729|  51.7k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  799|  51.7k|    d1n_1 = LOADU(in_odd + VREG_INT_COUNT);
  ------------------
  |  |  729|  51.7k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  800|       |
  801|       |    /* s0n = s1n - ((d1n + 1) >> 1); <==> */
  802|       |    /* s0n = s1n - ((d1n + d1n + 2) >> 2); */
  803|  51.7k|    s0n_0 = SUB(s1n_0, SAR(ADD3(d1n_0, d1n_0, two), 2));
  ------------------
  |  |  733|  51.7k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  804|  51.7k|    s0n_1 = SUB(s1n_1, SAR(ADD3(d1n_1, d1n_1, two), 2));
  ------------------
  |  |  733|  51.7k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  805|       |
  806|  2.75M|    for (i = 0, j = 1; i < (len - 3); i += 2, j++) {
  ------------------
  |  Branch (806:24): [True: 2.70M, False: 51.7k]
  ------------------
  807|  2.70M|        d1c_0 = d1n_0;
  808|  2.70M|        s0c_0 = s0n_0;
  809|  2.70M|        d1c_1 = d1n_1;
  810|  2.70M|        s0c_1 = s0n_1;
  811|       |
  812|  2.70M|        s1n_0 = LOADU(in_even + j * stride);
  ------------------
  |  |  729|  2.70M|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  813|  2.70M|        s1n_1 = LOADU(in_even + j * stride + VREG_INT_COUNT);
  ------------------
  |  |  729|  2.70M|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  814|  2.70M|        d1n_0 = LOADU(in_odd + j * stride);
  ------------------
  |  |  729|  2.70M|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  815|  2.70M|        d1n_1 = LOADU(in_odd + j * stride + VREG_INT_COUNT);
  ------------------
  |  |  729|  2.70M|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  816|       |
  817|       |        /*s0n = s1n - ((d1c + d1n + 2) >> 2);*/
  818|  2.70M|        s0n_0 = SUB(s1n_0, SAR(ADD3(d1c_0, d1n_0, two), 2));
  ------------------
  |  |  733|  2.70M|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  819|  2.70M|        s0n_1 = SUB(s1n_1, SAR(ADD3(d1c_1, d1n_1, two), 2));
  ------------------
  |  |  733|  2.70M|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  820|       |
  821|  2.70M|        STORE(tmp + PARALLEL_COLS_53 * (i + 0), s0c_0);
  ------------------
  |  |  730|  2.70M|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  822|  2.70M|        STORE(tmp + PARALLEL_COLS_53 * (i + 0) + VREG_INT_COUNT, s0c_1);
  ------------------
  |  |  730|  2.70M|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  823|       |
  824|       |        /* d1c + ((s0c + s0n) >> 1) */
  825|  2.70M|        STORE(tmp + PARALLEL_COLS_53 * (i + 1) + 0,
  ------------------
  |  |  730|  2.70M|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  826|  2.70M|              ADD(d1c_0, SAR(ADD(s0c_0, s0n_0), 1)));
  827|  2.70M|        STORE(tmp + PARALLEL_COLS_53 * (i + 1) + VREG_INT_COUNT,
  ------------------
  |  |  730|  2.70M|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  828|  2.70M|              ADD(d1c_1, SAR(ADD(s0c_1, s0n_1), 1)));
  829|  2.70M|    }
  830|       |
  831|  51.7k|    STORE(tmp + PARALLEL_COLS_53 * (i + 0) + 0, s0n_0);
  ------------------
  |  |  730|  51.7k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  832|  51.7k|    STORE(tmp + PARALLEL_COLS_53 * (i + 0) + VREG_INT_COUNT, s0n_1);
  ------------------
  |  |  730|  51.7k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  833|       |
  834|  51.7k|    if (len & 1) {
  ------------------
  |  Branch (834:9): [True: 25.4k, False: 26.2k]
  ------------------
  835|  25.4k|        VREG tmp_len_minus_1;
  ------------------
  |  |  726|  25.4k|#define VREG        __m128i
  ------------------
  836|  25.4k|        s1n_0 = LOADU(in_even + (OPJ_SIZE_T)((len - 1) / 2) * stride);
  ------------------
  |  |  729|  25.4k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  837|       |        /* tmp_len_minus_1 = s1n - ((d1n + 1) >> 1); */
  838|  25.4k|        tmp_len_minus_1 = SUB(s1n_0, SAR(ADD3(d1n_0, d1n_0, two), 2));
  ------------------
  |  |  733|  25.4k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  839|  25.4k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1), tmp_len_minus_1);
  ------------------
  |  |  730|  25.4k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  840|       |        /* d1n + ((s0n + tmp_len_minus_1) >> 1) */
  841|  25.4k|        STORE(tmp + PARALLEL_COLS_53 * (len - 2),
  ------------------
  |  |  730|  25.4k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  842|  25.4k|              ADD(d1n_0, SAR(ADD(s0n_0, tmp_len_minus_1), 1)));
  843|       |
  844|  25.4k|        s1n_1 = LOADU(in_even + (OPJ_SIZE_T)((len - 1) / 2) * stride + VREG_INT_COUNT);
  ------------------
  |  |  729|  25.4k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  845|       |        /* tmp_len_minus_1 = s1n - ((d1n + 1) >> 1); */
  846|  25.4k|        tmp_len_minus_1 = SUB(s1n_1, SAR(ADD3(d1n_1, d1n_1, two), 2));
  ------------------
  |  |  733|  25.4k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  847|  25.4k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT,
  ------------------
  |  |  730|  25.4k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  848|  25.4k|              tmp_len_minus_1);
  849|       |        /* d1n + ((s0n + tmp_len_minus_1) >> 1) */
  850|  25.4k|        STORE(tmp + PARALLEL_COLS_53 * (len - 2) + VREG_INT_COUNT,
  ------------------
  |  |  730|  25.4k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  851|  25.4k|              ADD(d1n_1, SAR(ADD(s0n_1, tmp_len_minus_1), 1)));
  852|       |
  853|       |
  854|  26.2k|    } else {
  855|  26.2k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + 0,
  ------------------
  |  |  730|  26.2k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  856|  26.2k|              ADD(d1n_0, s0n_0));
  857|  26.2k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT,
  ------------------
  |  |  730|  26.2k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  858|  26.2k|              ADD(d1n_1, s0n_1));
  859|  26.2k|    }
  860|       |
  861|  51.7k|    opj_idwt53_v_final_memcpy(tiledp_col, tmp, len, stride);
  862|  51.7k|}
dwt.c:opj_idwt53_v_final_memcpy:
  743|  64.6k|{
  744|  64.6k|    OPJ_INT32 i;
  745|  6.46M|    for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (745:17): [True: 6.39M, False: 64.6k]
  ------------------
  746|       |        /* A memcpy(&tiledp_col[i * stride + 0],
  747|       |                    &tmp[PARALLEL_COLS_53 * i + 0],
  748|       |                    PARALLEL_COLS_53 * sizeof(OPJ_INT32))
  749|       |           would do but would be a tiny bit slower.
  750|       |           We can take here advantage of our knowledge of alignment */
  751|  6.39M|        STOREU(&tiledp_col[(OPJ_SIZE_T)i * stride + 0],
  ------------------
  |  |  731|  6.39M|#define STOREU(x,y) _mm_storeu_si128((VREG*)(x),(y))
  ------------------
  752|  6.39M|               LOAD(&tmp[PARALLEL_COLS_53 * i + 0]));
  753|  6.39M|        STOREU(&tiledp_col[(OPJ_SIZE_T)i * stride + VREG_INT_COUNT],
  ------------------
  |  |  731|  6.39M|#define STOREU(x,y) _mm_storeu_si128((VREG*)(x),(y))
  ------------------
  754|  6.39M|               LOAD(&tmp[PARALLEL_COLS_53 * i + VREG_INT_COUNT]));
  755|  6.39M|    }
  756|  64.6k|}
dwt.c:opj_idwt3_v_cas0:
  990|  21.8k|{
  991|  21.8k|    OPJ_INT32 i, j;
  992|  21.8k|    OPJ_INT32 d1c, d1n, s1n, s0c, s0n;
  993|       |
  994|  21.8k|    assert(len > 1);
  995|       |
  996|       |    /* Performs lifting in one single iteration. Saves memory */
  997|       |    /* accesses and explicit interleaving. */
  998|       |
  999|  21.8k|    s1n = tiledp_col[0];
 1000|  21.8k|    d1n = tiledp_col[(OPJ_SIZE_T)sn * stride];
 1001|  21.8k|    s0n = s1n - ((d1n + 1) >> 1);
 1002|       |
 1003|   720k|    for (i = 0, j = 0; i < (len - 3); i += 2, j++) {
  ------------------
  |  Branch (1003:24): [True: 698k, False: 21.8k]
  ------------------
 1004|   698k|        d1c = d1n;
 1005|   698k|        s0c = s0n;
 1006|       |
 1007|   698k|        s1n = tiledp_col[(OPJ_SIZE_T)(j + 1) * stride];
 1008|   698k|        d1n = tiledp_col[(OPJ_SIZE_T)(sn + j + 1) * stride];
 1009|       |
 1010|   698k|        s0n = opj_int_sub_no_overflow(s1n,
 1011|   698k|                                      opj_int_add_no_overflow(opj_int_add_no_overflow(d1c, d1n), 2) >> 2);
 1012|       |
 1013|   698k|        tmp[i  ] = s0c;
 1014|   698k|        tmp[i + 1] = opj_int_add_no_overflow(d1c, opj_int_add_no_overflow(s0c,
 1015|   698k|                                             s0n) >> 1);
 1016|   698k|    }
 1017|       |
 1018|  21.8k|    tmp[i] = s0n;
 1019|       |
 1020|  21.8k|    if (len & 1) {
  ------------------
  |  Branch (1020:9): [True: 10.0k, False: 11.8k]
  ------------------
 1021|  10.0k|        tmp[len - 1] =
 1022|  10.0k|            tiledp_col[(OPJ_SIZE_T)((len - 1) / 2) * stride] -
 1023|  10.0k|            ((d1n + 1) >> 1);
 1024|  10.0k|        tmp[len - 2] = d1n + ((s0n + tmp[len - 1]) >> 1);
 1025|  11.8k|    } else {
 1026|  11.8k|        tmp[len - 1] = d1n + s0n;
 1027|  11.8k|    }
 1028|       |
 1029|  1.47M|    for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (1029:17): [True: 1.45M, False: 21.8k]
  ------------------
 1030|  1.45M|        tiledp_col[(OPJ_SIZE_T)i * stride] = tmp[i];
 1031|  1.45M|    }
 1032|  21.8k|}
dwt.c:opj_idwt53_v_cas1_mcols_SSE2_OR_AVX2:
  873|  12.9k|{
  874|  12.9k|    OPJ_INT32 i;
  875|  12.9k|    OPJ_SIZE_T j;
  876|       |
  877|  12.9k|    VREG s1_0, s2_0, dc_0, dn_0;
  ------------------
  |  |  726|  12.9k|#define VREG        __m128i
  ------------------
  878|  12.9k|    VREG s1_1, s2_1, dc_1, dn_1;
  ------------------
  |  |  726|  12.9k|#define VREG        __m128i
  ------------------
  879|  12.9k|    const VREG two = LOAD_CST(2);
  ------------------
  |  |  727|  12.9k|#define LOAD_CST(x) _mm_set1_epi32(x)
  ------------------
  880|       |
  881|  12.9k|    const OPJ_INT32* in_even = &tiledp_col[(OPJ_SIZE_T)sn * stride];
  882|  12.9k|    const OPJ_INT32* in_odd = &tiledp_col[0];
  883|       |
  884|  12.9k|    assert(len > 2);
  885|       |#if defined(__AVX512F__)
  886|       |    assert(PARALLEL_COLS_53 == 32);
  887|       |    assert(VREG_INT_COUNT == 16);
  888|       |#elif defined(__AVX2__)
  889|       |    assert(PARALLEL_COLS_53 == 16);
  890|       |    assert(VREG_INT_COUNT == 8);
  891|       |#else
  892|  12.9k|    assert(PARALLEL_COLS_53 == 8);
  893|  12.9k|    assert(VREG_INT_COUNT == 4);
  894|  12.9k|#endif
  895|       |
  896|       |//For AVX512 code aligned load/store is set to it's unaligned equivalents
  897|  12.9k|#if !defined(__AVX512F__)
  898|       |    /* Note: loads of input even/odd values must be done in a unaligned */
  899|       |    /* fashion. But stores in tmp can be done with aligned store, since */
  900|       |    /* the temporary buffer is properly aligned */
  901|  12.9k|    assert((OPJ_SIZE_T)tmp % (sizeof(OPJ_INT32) * VREG_INT_COUNT) == 0);
  902|  12.9k|#endif
  903|       |
  904|  12.9k|    s1_0 = LOADU(in_even + stride);
  ------------------
  |  |  729|  12.9k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  905|       |    /* in_odd[0] - ((in_even[0] + s1 + 2) >> 2); */
  906|  12.9k|    dc_0 = SUB(LOADU(in_odd + 0),
  ------------------
  |  |  733|  12.9k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  907|  12.9k|               SAR(ADD3(LOADU(in_even + 0), s1_0, two), 2));
  908|  12.9k|    STORE(tmp + PARALLEL_COLS_53 * 0, ADD(LOADU(in_even + 0), dc_0));
  ------------------
  |  |  730|  12.9k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  909|       |
  910|  12.9k|    s1_1 = LOADU(in_even + stride + VREG_INT_COUNT);
  ------------------
  |  |  729|  12.9k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  911|       |    /* in_odd[0] - ((in_even[0] + s1 + 2) >> 2); */
  912|  12.9k|    dc_1 = SUB(LOADU(in_odd + VREG_INT_COUNT),
  ------------------
  |  |  733|  12.9k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  913|  12.9k|               SAR(ADD3(LOADU(in_even + VREG_INT_COUNT), s1_1, two), 2));
  914|  12.9k|    STORE(tmp + PARALLEL_COLS_53 * 0 + VREG_INT_COUNT,
  ------------------
  |  |  730|  12.9k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  915|  12.9k|          ADD(LOADU(in_even + VREG_INT_COUNT), dc_1));
  916|       |
  917|   423k|    for (i = 1, j = 1; i < (len - 2 - !(len & 1)); i += 2, j++) {
  ------------------
  |  Branch (917:24): [True: 410k, False: 12.9k]
  ------------------
  918|       |
  919|   410k|        s2_0 = LOADU(in_even + (j + 1) * stride);
  ------------------
  |  |  729|   410k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  920|   410k|        s2_1 = LOADU(in_even + (j + 1) * stride + VREG_INT_COUNT);
  ------------------
  |  |  729|   410k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  921|       |
  922|       |        /* dn = in_odd[j * stride] - ((s1 + s2 + 2) >> 2); */
  923|   410k|        dn_0 = SUB(LOADU(in_odd + j * stride),
  ------------------
  |  |  733|   410k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  924|   410k|                   SAR(ADD3(s1_0, s2_0, two), 2));
  925|   410k|        dn_1 = SUB(LOADU(in_odd + j * stride + VREG_INT_COUNT),
  ------------------
  |  |  733|   410k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  926|   410k|                   SAR(ADD3(s1_1, s2_1, two), 2));
  927|       |
  928|   410k|        STORE(tmp + PARALLEL_COLS_53 * i, dc_0);
  ------------------
  |  |  730|   410k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  929|   410k|        STORE(tmp + PARALLEL_COLS_53 * i + VREG_INT_COUNT, dc_1);
  ------------------
  |  |  730|   410k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  930|       |
  931|       |        /* tmp[i + 1] = s1 + ((dn + dc) >> 1); */
  932|   410k|        STORE(tmp + PARALLEL_COLS_53 * (i + 1) + 0,
  ------------------
  |  |  730|   410k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  933|   410k|              ADD(s1_0, SAR(ADD(dn_0, dc_0), 1)));
  934|   410k|        STORE(tmp + PARALLEL_COLS_53 * (i + 1) + VREG_INT_COUNT,
  ------------------
  |  |  730|   410k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  935|   410k|              ADD(s1_1, SAR(ADD(dn_1, dc_1), 1)));
  936|       |
  937|   410k|        dc_0 = dn_0;
  938|   410k|        s1_0 = s2_0;
  939|   410k|        dc_1 = dn_1;
  940|   410k|        s1_1 = s2_1;
  941|   410k|    }
  942|  12.9k|    STORE(tmp + PARALLEL_COLS_53 * i, dc_0);
  ------------------
  |  |  730|  12.9k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  943|  12.9k|    STORE(tmp + PARALLEL_COLS_53 * i + VREG_INT_COUNT, dc_1);
  ------------------
  |  |  730|  12.9k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  944|       |
  945|  12.9k|    if (!(len & 1)) {
  ------------------
  |  Branch (945:9): [True: 5.49k, False: 7.47k]
  ------------------
  946|       |        /*dn = in_odd[(len / 2 - 1) * stride] - ((s1 + 1) >> 1); */
  947|  5.49k|        dn_0 = SUB(LOADU(in_odd + (OPJ_SIZE_T)(len / 2 - 1) * stride),
  ------------------
  |  |  733|  5.49k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  948|  5.49k|                   SAR(ADD3(s1_0, s1_0, two), 2));
  949|  5.49k|        dn_1 = SUB(LOADU(in_odd + (OPJ_SIZE_T)(len / 2 - 1) * stride + VREG_INT_COUNT),
  ------------------
  |  |  733|  5.49k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  950|  5.49k|                   SAR(ADD3(s1_1, s1_1, two), 2));
  951|       |
  952|       |        /* tmp[len - 2] = s1 + ((dn + dc) >> 1); */
  953|  5.49k|        STORE(tmp + PARALLEL_COLS_53 * (len - 2) + 0,
  ------------------
  |  |  730|  5.49k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  954|  5.49k|              ADD(s1_0, SAR(ADD(dn_0, dc_0), 1)));
  955|  5.49k|        STORE(tmp + PARALLEL_COLS_53 * (len - 2) + VREG_INT_COUNT,
  ------------------
  |  |  730|  5.49k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  956|  5.49k|              ADD(s1_1, SAR(ADD(dn_1, dc_1), 1)));
  957|       |
  958|  5.49k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + 0, dn_0);
  ------------------
  |  |  730|  5.49k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  959|  5.49k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT, dn_1);
  ------------------
  |  |  730|  5.49k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  960|  7.47k|    } else {
  961|  7.47k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + 0, ADD(s1_0, dc_0));
  ------------------
  |  |  730|  7.47k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  962|  7.47k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT,
  ------------------
  |  |  730|  7.47k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  963|  7.47k|              ADD(s1_1, dc_1));
  964|  7.47k|    }
  965|       |
  966|  12.9k|    opj_idwt53_v_final_memcpy(tiledp_col, tmp, len, stride);
  967|  12.9k|}
dwt.c:opj_idwt3_v_cas1:
 1042|  14.5k|{
 1043|  14.5k|    OPJ_INT32 i, j;
 1044|  14.5k|    OPJ_INT32 s1, s2, dc, dn;
 1045|  14.5k|    const OPJ_INT32* in_even = &tiledp_col[(OPJ_SIZE_T)sn * stride];
 1046|  14.5k|    const OPJ_INT32* in_odd = &tiledp_col[0];
 1047|       |
 1048|  14.5k|    assert(len > 2);
 1049|       |
 1050|       |    /* Performs lifting in one single iteration. Saves memory */
 1051|       |    /* accesses and explicit interleaving. */
 1052|       |
 1053|  14.5k|    s1 = in_even[stride];
 1054|  14.5k|    dc = in_odd[0] - ((in_even[0] + s1 + 2) >> 2);
 1055|  14.5k|    tmp[0] = in_even[0] + dc;
 1056|   272k|    for (i = 1, j = 1; i < (len - 2 - !(len & 1)); i += 2, j++) {
  ------------------
  |  Branch (1056:24): [True: 257k, False: 14.5k]
  ------------------
 1057|       |
 1058|   257k|        s2 = in_even[(OPJ_SIZE_T)(j + 1) * stride];
 1059|       |
 1060|   257k|        dn = in_odd[(OPJ_SIZE_T)j * stride] - ((s1 + s2 + 2) >> 2);
 1061|   257k|        tmp[i  ] = dc;
 1062|   257k|        tmp[i + 1] = s1 + ((dn + dc) >> 1);
 1063|       |
 1064|   257k|        dc = dn;
 1065|   257k|        s1 = s2;
 1066|   257k|    }
 1067|  14.5k|    tmp[i] = dc;
 1068|  14.5k|    if (!(len & 1)) {
  ------------------
  |  Branch (1068:9): [True: 5.99k, False: 8.59k]
  ------------------
 1069|  5.99k|        dn = in_odd[(OPJ_SIZE_T)(len / 2 - 1) * stride] - ((s1 + 1) >> 1);
 1070|  5.99k|        tmp[len - 2] = s1 + ((dn + dc) >> 1);
 1071|  5.99k|        tmp[len - 1] = dn;
 1072|  8.59k|    } else {
 1073|  8.59k|        tmp[len - 1] = s1 + dc;
 1074|  8.59k|    }
 1075|       |
 1076|   579k|    for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (1076:17): [True: 565k, False: 14.5k]
  ------------------
 1077|   565k|        tiledp_col[(OPJ_SIZE_T)i * stride] = tmp[i];
 1078|   565k|    }
 1079|  14.5k|}
dwt.c:opj_dwt_decode_partial_tile:
 2834|  2.88k|{
 2835|  2.88k|    opj_sparse_array_int32_t* sa;
 2836|  2.88k|    opj_dwt_t h;
 2837|  2.88k|    opj_dwt_t v;
 2838|  2.88k|    OPJ_UINT32 resno;
 2839|       |    /* This value matches the maximum left/right extension given in tables */
 2840|       |    /* F.2 and F.3 of the standard. */
 2841|  2.88k|    const OPJ_UINT32 filter_width = 2U;
 2842|       |
 2843|  2.88k|    opj_tcd_resolution_t* tr = tilec->resolutions;
 2844|  2.88k|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 2845|       |
 2846|  2.88k|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 2847|  2.88k|                                 tr->x0);  /* width of the resolution level computed */
 2848|  2.88k|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 2849|  2.88k|                                 tr->y0);  /* height of the resolution level computed */
 2850|       |
 2851|  2.88k|    OPJ_SIZE_T h_mem_size;
 2852|       |
 2853|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 2854|       |    /* with the tile coordinates */
 2855|  2.88k|    OPJ_UINT32 win_tcx0 = tilec->win_x0;
 2856|  2.88k|    OPJ_UINT32 win_tcy0 = tilec->win_y0;
 2857|  2.88k|    OPJ_UINT32 win_tcx1 = tilec->win_x1;
 2858|  2.88k|    OPJ_UINT32 win_tcy1 = tilec->win_y1;
 2859|       |
 2860|  2.88k|    if (tr_max->x0 == tr_max->x1 || tr_max->y0 == tr_max->y1) {
  ------------------
  |  Branch (2860:9): [True: 447, False: 2.43k]
  |  Branch (2860:37): [True: 53, False: 2.38k]
  ------------------
 2861|    500|        return OPJ_TRUE;
  ------------------
  |  |  117|    500|#define OPJ_TRUE 1
  ------------------
 2862|    500|    }
 2863|       |
 2864|  2.38k|    sa = opj_dwt_init_sparse_array(tilec, numres);
 2865|  2.38k|    if (sa == NULL) {
  ------------------
  |  Branch (2865:9): [True: 0, False: 2.38k]
  ------------------
 2866|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2867|      0|    }
 2868|       |
 2869|  2.38k|    if (numres == 1U) {
  ------------------
  |  Branch (2869:9): [True: 441, False: 1.94k]
  ------------------
 2870|    441|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 2871|    441|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 2872|    441|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 2873|    441|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 2874|    441|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 2875|    441|                       tilec->data_win,
 2876|    441|                       1, tr_max->win_x1 - tr_max->win_x0,
 2877|    441|                       OPJ_TRUE);
  ------------------
  |  |  117|    441|#define OPJ_TRUE 1
  ------------------
 2878|    441|        assert(ret);
 2879|    441|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|    441|#define OPJ_UNUSED(x) (void)x
  ------------------
 2880|    441|        opj_sparse_array_int32_free(sa);
 2881|    441|        return OPJ_TRUE;
  ------------------
  |  |  117|    441|#define OPJ_TRUE 1
  ------------------
 2882|    441|    }
 2883|  1.94k|    h_mem_size = opj_dwt_max_resolution(tr, numres);
 2884|       |    /* overflow check */
 2885|       |    /* in vertical pass, we process 4 columns at a time */
 2886|  1.94k|    if (h_mem_size > (SIZE_MAX / (4 * sizeof(OPJ_INT32)))) {
  ------------------
  |  Branch (2886:9): [True: 0, False: 1.94k]
  ------------------
 2887|       |        /* FIXME event manager error callback */
 2888|      0|        opj_sparse_array_int32_free(sa);
 2889|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2890|      0|    }
 2891|       |
 2892|  1.94k|    h_mem_size *= 4 * sizeof(OPJ_INT32);
 2893|  1.94k|    h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2894|  1.94k|    if (! h.mem) {
  ------------------
  |  Branch (2894:9): [True: 0, False: 1.94k]
  ------------------
 2895|       |        /* FIXME event manager error callback */
 2896|      0|        opj_sparse_array_int32_free(sa);
 2897|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2898|      0|    }
 2899|       |
 2900|  1.94k|    v.mem = h.mem;
 2901|       |
 2902|  24.6k|    for (resno = 1; resno < numres; resno ++) {
  ------------------
  |  Branch (2902:21): [True: 22.7k, False: 1.94k]
  ------------------
 2903|  22.7k|        OPJ_UINT32 i, j;
 2904|       |        /* Window of interest subband-based coordinates */
 2905|  22.7k|        OPJ_UINT32 win_ll_x0, win_ll_y0, win_ll_x1, win_ll_y1;
 2906|  22.7k|        OPJ_UINT32 win_hl_x0, win_hl_x1;
 2907|  22.7k|        OPJ_UINT32 win_lh_y0, win_lh_y1;
 2908|       |        /* Window of interest tile-resolution-based coordinates */
 2909|  22.7k|        OPJ_UINT32 win_tr_x0, win_tr_x1, win_tr_y0, win_tr_y1;
 2910|       |        /* Tile-resolution subband-based coordinates */
 2911|  22.7k|        OPJ_UINT32 tr_ll_x0, tr_ll_y0, tr_hl_x0, tr_lh_y0;
 2912|       |
 2913|  22.7k|        ++tr;
 2914|       |
 2915|  22.7k|        h.sn = (OPJ_INT32)rw;
 2916|  22.7k|        v.sn = (OPJ_INT32)rh;
 2917|       |
 2918|  22.7k|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 2919|  22.7k|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 2920|       |
 2921|  22.7k|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 2922|  22.7k|        h.cas = tr->x0 % 2;
 2923|       |
 2924|  22.7k|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 2925|  22.7k|        v.cas = tr->y0 % 2;
 2926|       |
 2927|       |        /* Get the subband coordinates for the window of interest */
 2928|       |        /* LL band */
 2929|  22.7k|        opj_dwt_get_band_coordinates(tilec, resno, 0,
 2930|  22.7k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2931|  22.7k|                                     &win_ll_x0, &win_ll_y0,
 2932|  22.7k|                                     &win_ll_x1, &win_ll_y1);
 2933|       |
 2934|       |        /* HL band */
 2935|  22.7k|        opj_dwt_get_band_coordinates(tilec, resno, 1,
 2936|  22.7k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2937|  22.7k|                                     &win_hl_x0, NULL, &win_hl_x1, NULL);
 2938|       |
 2939|       |        /* LH band */
 2940|  22.7k|        opj_dwt_get_band_coordinates(tilec, resno, 2,
 2941|  22.7k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2942|  22.7k|                                     NULL, &win_lh_y0, NULL, &win_lh_y1);
 2943|       |
 2944|       |        /* Beware: band index for non-LL0 resolution are 0=HL, 1=LH and 2=HH */
 2945|  22.7k|        tr_ll_x0 = (OPJ_UINT32)tr->bands[1].x0;
 2946|  22.7k|        tr_ll_y0 = (OPJ_UINT32)tr->bands[0].y0;
 2947|  22.7k|        tr_hl_x0 = (OPJ_UINT32)tr->bands[0].x0;
 2948|  22.7k|        tr_lh_y0 = (OPJ_UINT32)tr->bands[1].y0;
 2949|       |
 2950|       |        /* Subtract the origin of the bands for this tile, to the subwindow */
 2951|       |        /* of interest band coordinates, so as to get them relative to the */
 2952|       |        /* tile */
 2953|  22.7k|        win_ll_x0 = opj_uint_subs(win_ll_x0, tr_ll_x0);
 2954|  22.7k|        win_ll_y0 = opj_uint_subs(win_ll_y0, tr_ll_y0);
 2955|  22.7k|        win_ll_x1 = opj_uint_subs(win_ll_x1, tr_ll_x0);
 2956|  22.7k|        win_ll_y1 = opj_uint_subs(win_ll_y1, tr_ll_y0);
 2957|  22.7k|        win_hl_x0 = opj_uint_subs(win_hl_x0, tr_hl_x0);
 2958|  22.7k|        win_hl_x1 = opj_uint_subs(win_hl_x1, tr_hl_x0);
 2959|  22.7k|        win_lh_y0 = opj_uint_subs(win_lh_y0, tr_lh_y0);
 2960|  22.7k|        win_lh_y1 = opj_uint_subs(win_lh_y1, tr_lh_y0);
 2961|       |
 2962|  22.7k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.sn, &win_ll_x0, &win_ll_x1);
 2963|  22.7k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.dn, &win_hl_x0, &win_hl_x1);
 2964|       |
 2965|  22.7k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.sn, &win_ll_y0, &win_ll_y1);
 2966|  22.7k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.dn, &win_lh_y0, &win_lh_y1);
 2967|       |
 2968|       |        /* Compute the tile-resolution-based coordinates for the window of interest */
 2969|  22.7k|        if (h.cas == 0) {
  ------------------
  |  Branch (2969:13): [True: 10.0k, False: 12.6k]
  ------------------
 2970|  10.0k|            win_tr_x0 = opj_uint_min(2 * win_ll_x0, 2 * win_hl_x0 + 1);
 2971|  10.0k|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_ll_x1, 2 * win_hl_x1 + 1), rw);
 2972|  12.6k|        } else {
 2973|  12.6k|            win_tr_x0 = opj_uint_min(2 * win_hl_x0, 2 * win_ll_x0 + 1);
 2974|  12.6k|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_hl_x1, 2 * win_ll_x1 + 1), rw);
 2975|  12.6k|        }
 2976|       |
 2977|  22.7k|        if (v.cas == 0) {
  ------------------
  |  Branch (2977:13): [True: 8.10k, False: 14.6k]
  ------------------
 2978|  8.10k|            win_tr_y0 = opj_uint_min(2 * win_ll_y0, 2 * win_lh_y0 + 1);
 2979|  8.10k|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_ll_y1, 2 * win_lh_y1 + 1), rh);
 2980|  14.6k|        } else {
 2981|  14.6k|            win_tr_y0 = opj_uint_min(2 * win_lh_y0, 2 * win_ll_y0 + 1);
 2982|  14.6k|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_lh_y1, 2 * win_ll_y1 + 1), rh);
 2983|  14.6k|        }
 2984|       |
 2985|  1.43G|        for (j = 0; j < rh; ++j) {
  ------------------
  |  Branch (2985:21): [True: 1.43G, False: 22.7k]
  ------------------
 2986|  1.43G|            if ((j >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  Branch (2986:18): [True: 1.43G, False: 0]
  |  Branch (2986:36): [True: 1.16M, False: 1.43G]
  ------------------
 2987|  1.43G|                    (j >= win_lh_y0 + (OPJ_UINT32)v.sn && j < win_lh_y1 + (OPJ_UINT32)v.sn)) {
  ------------------
  |  Branch (2987:22): [True: 719M, False: 718M]
  |  Branch (2987:59): [True: 1.16M, False: 718M]
  ------------------
 2988|       |
 2989|       |                /* Avoids dwt.c:1584:44 (in opj_dwt_decode_partial_1): runtime error: */
 2990|       |                /* signed integer overflow: -1094795586 + -1094795586 cannot be represented in type 'int' */
 2991|       |                /* on opj_decompress -i  ../../openjpeg/MAPA.jp2 -o out.tif -d 0,0,256,256 */
 2992|       |                /* This is less extreme than memsetting the whole buffer to 0 */
 2993|       |                /* although we could potentially do better with better handling of edge conditions */
 2994|  2.32M|                if (win_tr_x1 >= 1 && win_tr_x1 < rw) {
  ------------------
  |  Branch (2994:21): [True: 2.30M, False: 22.1k]
  |  Branch (2994:39): [True: 238k, False: 2.06M]
  ------------------
 2995|   238k|                    h.mem[win_tr_x1 - 1] = 0;
 2996|   238k|                }
 2997|  2.32M|                if (win_tr_x1 < rw) {
  ------------------
  |  Branch (2997:21): [True: 238k, False: 2.08M]
  ------------------
 2998|   238k|                    h.mem[win_tr_x1] = 0;
 2999|   238k|                }
 3000|       |
 3001|  2.32M|                opj_dwt_interleave_partial_h(h.mem,
 3002|  2.32M|                                             h.cas,
 3003|  2.32M|                                             sa,
 3004|  2.32M|                                             j,
 3005|  2.32M|                                             (OPJ_UINT32)h.sn,
 3006|  2.32M|                                             win_ll_x0,
 3007|  2.32M|                                             win_ll_x1,
 3008|  2.32M|                                             win_hl_x0,
 3009|  2.32M|                                             win_hl_x1);
 3010|  2.32M|                opj_dwt_decode_partial_1(h.mem, h.dn, h.sn, h.cas,
 3011|  2.32M|                                         (OPJ_INT32)win_ll_x0,
 3012|  2.32M|                                         (OPJ_INT32)win_ll_x1,
 3013|  2.32M|                                         (OPJ_INT32)win_hl_x0,
 3014|  2.32M|                                         (OPJ_INT32)win_hl_x1);
 3015|  2.32M|                if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3015:21): [True: 0, False: 2.32M]
  ------------------
 3016|  2.32M|                                                  win_tr_x0, j,
 3017|  2.32M|                                                  win_tr_x1, j + 1,
 3018|  2.32M|                                                  h.mem + win_tr_x0,
 3019|  2.32M|                                                  1, 0, OPJ_TRUE)) {
  ------------------
  |  |  117|  2.32M|#define OPJ_TRUE 1
  ------------------
 3020|       |                    /* FIXME event manager error callback */
 3021|      0|                    opj_sparse_array_int32_free(sa);
 3022|      0|                    opj_aligned_free(h.mem);
 3023|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3024|      0|                }
 3025|  2.32M|            }
 3026|  1.43G|        }
 3027|       |
 3028|   172k|        for (i = win_tr_x0; i < win_tr_x1;) {
  ------------------
  |  Branch (3028:29): [True: 149k, False: 22.7k]
  ------------------
 3029|   149k|            OPJ_UINT32 nb_cols = opj_uint_min(4U, win_tr_x1 - i);
 3030|   149k|            opj_dwt_interleave_partial_v(v.mem,
 3031|   149k|                                         v.cas,
 3032|   149k|                                         sa,
 3033|   149k|                                         i,
 3034|   149k|                                         nb_cols,
 3035|   149k|                                         (OPJ_UINT32)v.sn,
 3036|   149k|                                         win_ll_y0,
 3037|   149k|                                         win_ll_y1,
 3038|   149k|                                         win_lh_y0,
 3039|   149k|                                         win_lh_y1);
 3040|   149k|            opj_dwt_decode_partial_1_parallel(v.mem, nb_cols, v.dn, v.sn, v.cas,
 3041|   149k|                                              (OPJ_INT32)win_ll_y0,
 3042|   149k|                                              (OPJ_INT32)win_ll_y1,
 3043|   149k|                                              (OPJ_INT32)win_lh_y0,
 3044|   149k|                                              (OPJ_INT32)win_lh_y1);
 3045|   149k|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3045:17): [True: 0, False: 149k]
  ------------------
 3046|   149k|                                              i, win_tr_y0,
 3047|   149k|                                              i + nb_cols, win_tr_y1,
 3048|   149k|                                              v.mem + 4 * win_tr_y0,
 3049|   149k|                                              1, 4, OPJ_TRUE)) {
  ------------------
  |  |  117|   149k|#define OPJ_TRUE 1
  ------------------
 3050|       |                /* FIXME event manager error callback */
 3051|      0|                opj_sparse_array_int32_free(sa);
 3052|      0|                opj_aligned_free(h.mem);
 3053|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3054|      0|            }
 3055|       |
 3056|   149k|            i += nb_cols;
 3057|   149k|        }
 3058|  22.7k|    }
 3059|  1.94k|    opj_aligned_free(h.mem);
 3060|       |
 3061|  1.94k|    {
 3062|  1.94k|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 3063|  1.94k|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 3064|  1.94k|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 3065|  1.94k|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 3066|  1.94k|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 3067|  1.94k|                       tilec->data_win,
 3068|  1.94k|                       1, tr_max->win_x1 - tr_max->win_x0,
 3069|  1.94k|                       OPJ_TRUE);
  ------------------
  |  |  117|  1.94k|#define OPJ_TRUE 1
  ------------------
 3070|  1.94k|        assert(ret);
 3071|  1.94k|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|  1.94k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3072|  1.94k|    }
 3073|  1.94k|    opj_sparse_array_int32_free(sa);
 3074|  1.94k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.94k|#define OPJ_TRUE 1
  ------------------
 3075|  1.94k|}
dwt.c:opj_dwt_init_sparse_array:
 2778|  3.57k|{
 2779|  3.57k|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 2780|  3.57k|    OPJ_UINT32 w = (OPJ_UINT32)(tr_max->x1 - tr_max->x0);
 2781|  3.57k|    OPJ_UINT32 h = (OPJ_UINT32)(tr_max->y1 - tr_max->y0);
 2782|  3.57k|    OPJ_UINT32 resno, bandno, precno, cblkno;
 2783|  3.57k|    opj_sparse_array_int32_t* sa = opj_sparse_array_int32_create(
 2784|  3.57k|                                       w, h, opj_uint_min(w, 64), opj_uint_min(h, 64));
 2785|  3.57k|    if (sa == NULL) {
  ------------------
  |  Branch (2785:9): [True: 0, False: 3.57k]
  ------------------
 2786|      0|        return NULL;
 2787|      0|    }
 2788|       |
 2789|  32.7k|    for (resno = 0; resno < numres; ++resno) {
  ------------------
  |  Branch (2789:21): [True: 29.1k, False: 3.57k]
  ------------------
 2790|  29.1k|        opj_tcd_resolution_t* res = &tilec->resolutions[resno];
 2791|       |
 2792|   109k|        for (bandno = 0; bandno < res->numbands; ++bandno) {
  ------------------
  |  Branch (2792:26): [True: 80.3k, False: 29.1k]
  ------------------
 2793|  80.3k|            opj_tcd_band_t* band = &res->bands[bandno];
 2794|       |
 2795|  1.37M|            for (precno = 0; precno < res->pw * res->ph; ++precno) {
  ------------------
  |  Branch (2795:30): [True: 1.29M, False: 80.3k]
  ------------------
 2796|  1.29M|                opj_tcd_precinct_t* precinct = &band->precincts[precno];
 2797|  97.5M|                for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (2797:34): [True: 96.2M, False: 1.29M]
  ------------------
 2798|  96.2M|                    opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 2799|  96.2M|                    if (cblk->decoded_data != NULL) {
  ------------------
  |  Branch (2799:25): [True: 358k, False: 95.8M]
  ------------------
 2800|   358k|                        OPJ_UINT32 x = (OPJ_UINT32)(cblk->x0 - band->x0);
 2801|   358k|                        OPJ_UINT32 y = (OPJ_UINT32)(cblk->y0 - band->y0);
 2802|   358k|                        OPJ_UINT32 cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 2803|   358k|                        OPJ_UINT32 cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 2804|       |
 2805|   358k|                        if (band->bandno & 1) {
  ------------------
  |  Branch (2805:29): [True: 131k, False: 227k]
  ------------------
 2806|   131k|                            opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 2807|   131k|                            x += (OPJ_UINT32)(pres->x1 - pres->x0);
 2808|   131k|                        }
 2809|   358k|                        if (band->bandno & 2) {
  ------------------
  |  Branch (2809:29): [True: 144k, False: 213k]
  ------------------
 2810|   144k|                            opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 2811|   144k|                            y += (OPJ_UINT32)(pres->y1 - pres->y0);
 2812|   144k|                        }
 2813|       |
 2814|   358k|                        if (!opj_sparse_array_int32_write(sa, x, y,
  ------------------
  |  Branch (2814:29): [True: 0, False: 358k]
  ------------------
 2815|   358k|                                                          x + cblk_w, y + cblk_h,
 2816|   358k|                                                          cblk->decoded_data,
 2817|   358k|                                                          1, cblk_w, OPJ_TRUE)) {
  ------------------
  |  |  117|   358k|#define OPJ_TRUE 1
  ------------------
 2818|      0|                            opj_sparse_array_int32_free(sa);
 2819|      0|                            return NULL;
 2820|      0|                        }
 2821|   358k|                    }
 2822|  96.2M|                }
 2823|  1.29M|            }
 2824|  80.3k|        }
 2825|  29.1k|    }
 2826|       |
 2827|  3.57k|    return sa;
 2828|  3.57k|}
dwt.c:opj_dwt_get_band_coordinates:
 2733|  76.7k|{
 2734|       |    /* Compute number of decomposition for this band. See table F-1 */
 2735|  76.7k|    OPJ_UINT32 nb = (resno == 0) ?
  ------------------
  |  Branch (2735:21): [True: 0, False: 76.7k]
  ------------------
 2736|      0|                    tilec->numresolutions - 1 :
 2737|  76.7k|                    tilec->numresolutions - resno;
 2738|       |    /* Map above tile-based coordinates to sub-band-based coordinates per */
 2739|       |    /* equation B-15 of the standard */
 2740|  76.7k|    OPJ_UINT32 x0b = bandno & 1;
 2741|  76.7k|    OPJ_UINT32 y0b = bandno >> 1;
 2742|  76.7k|    if (tbx0) {
  ------------------
  |  Branch (2742:9): [True: 51.1k, False: 25.5k]
  ------------------
 2743|  51.1k|        *tbx0 = (nb == 0) ? tcx0 :
  ------------------
  |  Branch (2743:17): [True: 0, False: 51.1k]
  ------------------
 2744|  51.1k|                (tcx0 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2744:17): [True: 26.3k, False: 24.8k]
  ------------------
 2745|  51.1k|                opj_uint_ceildivpow2(tcx0 - (1U << (nb - 1)) * x0b, nb);
 2746|  51.1k|    }
 2747|  76.7k|    if (tby0) {
  ------------------
  |  Branch (2747:9): [True: 51.1k, False: 25.5k]
  ------------------
 2748|  51.1k|        *tby0 = (nb == 0) ? tcy0 :
  ------------------
  |  Branch (2748:17): [True: 0, False: 51.1k]
  ------------------
 2749|  51.1k|                (tcy0 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2749:17): [True: 22.5k, False: 28.6k]
  ------------------
 2750|  51.1k|                opj_uint_ceildivpow2(tcy0 - (1U << (nb - 1)) * y0b, nb);
 2751|  51.1k|    }
 2752|  76.7k|    if (tbx1) {
  ------------------
  |  Branch (2752:9): [True: 51.1k, False: 25.5k]
  ------------------
 2753|  51.1k|        *tbx1 = (nb == 0) ? tcx1 :
  ------------------
  |  Branch (2753:17): [True: 0, False: 51.1k]
  ------------------
 2754|  51.1k|                (tcx1 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2754:17): [True: 13.6k, False: 37.5k]
  ------------------
 2755|  51.1k|                opj_uint_ceildivpow2(tcx1 - (1U << (nb - 1)) * x0b, nb);
 2756|  51.1k|    }
 2757|  76.7k|    if (tby1) {
  ------------------
  |  Branch (2757:9): [True: 51.1k, False: 25.5k]
  ------------------
 2758|  51.1k|        *tby1 = (nb == 0) ? tcy1 :
  ------------------
  |  Branch (2758:17): [True: 0, False: 51.1k]
  ------------------
 2759|  51.1k|                (tcy1 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2759:17): [True: 10.2k, False: 40.9k]
  ------------------
 2760|  51.1k|                opj_uint_ceildivpow2(tcy1 - (1U << (nb - 1)) * y0b, nb);
 2761|  51.1k|    }
 2762|  76.7k|}
dwt.c:opj_dwt_segment_grow:
 2768|   102k|{
 2769|   102k|    *start = opj_uint_subs(*start, filter_width);
 2770|   102k|    *end = opj_uint_adds(*end, filter_width);
 2771|   102k|    *end = opj_uint_min(*end, max_size);
 2772|   102k|}
dwt.c:opj_dwt_interleave_partial_h:
 2450|  2.32M|{
 2451|  2.32M|    OPJ_BOOL ret;
 2452|  2.32M|    ret = opj_sparse_array_int32_read(sa,
 2453|  2.32M|                                      win_l_x0, sa_line,
 2454|  2.32M|                                      win_l_x1, sa_line + 1,
 2455|  2.32M|                                      dest + cas + 2 * win_l_x0,
 2456|  2.32M|                                      2, 0, OPJ_TRUE);
  ------------------
  |  |  117|  2.32M|#define OPJ_TRUE 1
  ------------------
 2457|  2.32M|    assert(ret);
 2458|  2.32M|    ret = opj_sparse_array_int32_read(sa,
 2459|  2.32M|                                      sn + win_h_x0, sa_line,
 2460|  2.32M|                                      sn + win_h_x1, sa_line + 1,
 2461|  2.32M|                                      dest + 1 - cas + 2 * win_h_x0,
 2462|  2.32M|                                      2, 0, OPJ_TRUE);
  ------------------
  |  |  117|  2.32M|#define OPJ_TRUE 1
  ------------------
 2463|  2.32M|    assert(ret);
 2464|  2.32M|    OPJ_UNUSED(ret);
  ------------------
  |  |  221|  2.32M|#define OPJ_UNUSED(x) (void)x
  ------------------
 2465|  2.32M|}
dwt.c:opj_dwt_decode_partial_1:
 2501|  2.32M|{
 2502|  2.32M|    OPJ_INT32 i;
 2503|       |
 2504|  2.32M|    if (!cas) {
  ------------------
  |  Branch (2504:9): [True: 2.19M, False: 131k]
  ------------------
 2505|  2.19M|        if ((dn > 0) || (sn > 1)) { /* NEW :  CASE ONE ELEMENT */
  ------------------
  |  Branch (2505:13): [True: 710k, False: 1.48M]
  |  Branch (2505:25): [True: 0, False: 1.48M]
  ------------------
 2506|       |
 2507|       |            /* Naive version is :
 2508|       |            for (i = win_l_x0; i < i_max; i++) {
 2509|       |                OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
 2510|       |            }
 2511|       |            for (i = win_h_x0; i < win_h_x1; i++) {
 2512|       |                OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
 2513|       |            }
 2514|       |            but the compiler doesn't manage to unroll it to avoid bound
 2515|       |            checking in OPJ_S_ and OPJ_D_ macros
 2516|       |            */
 2517|       |
 2518|   710k|            i = win_l_x0;
 2519|   710k|            if (i < win_l_x1) {
  ------------------
  |  Branch (2519:17): [True: 710k, False: 0]
  ------------------
 2520|   710k|                OPJ_INT32 i_max;
 2521|       |
 2522|       |                /* Left-most case */
 2523|   710k|                OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  187|   710k|#define OPJ_S(i) a[(i)*2]
  ------------------
                              OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  190|   710k|#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|   710k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (190:20): [True: 710k, False: 0]
  |  |  |  Branch (190:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  190|   710k|#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|   710k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (190:20): [True: 0, False: 710k]
  |  |  |  Branch (190:36): [True: 0, False: 710k]
  |  |  ------------------
  ------------------
 2524|   710k|                i ++;
 2525|       |
 2526|   710k|                i_max = win_l_x1;
 2527|   710k|                if (i_max > dn) {
  ------------------
  |  Branch (2527:21): [True: 425k, False: 284k]
  ------------------
 2528|   425k|                    i_max = dn;
 2529|   425k|                }
 2530|   101M|                for (; i < i_max; i++) {
  ------------------
  |  Branch (2530:24): [True: 100M, False: 710k]
  ------------------
 2531|       |                    /* No bound checking */
 2532|   100M|                    OPJ_S(i) -= (OPJ_D(i - 1) + OPJ_D(i) + 2) >> 2;
  ------------------
  |  |  187|   100M|#define OPJ_S(i) a[(i)*2]
  ------------------
                                  OPJ_S(i) -= (OPJ_D(i - 1) + OPJ_D(i) + 2) >> 2;
  ------------------
  |  |  188|   100M|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
                                  OPJ_S(i) -= (OPJ_D(i - 1) + OPJ_D(i) + 2) >> 2;
  ------------------
  |  |  188|   100M|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
 2533|   100M|                }
 2534|  1.13M|                for (; i < win_l_x1; i++) {
  ------------------
  |  Branch (2534:24): [True: 425k, False: 710k]
  ------------------
 2535|       |                    /* Right-most case */
 2536|   425k|                    OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  187|   425k|#define OPJ_S(i) a[(i)*2]
  ------------------
                                  OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  190|   425k|#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|   425k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (190:20): [True: 0, False: 425k]
  |  |  |  Branch (190:36): [True: 0, False: 425k]
  |  |  ------------------
  ------------------
                                  OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  190|   425k|#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|   425k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (190:20): [True: 0, False: 425k]
  |  |  |  Branch (190:36): [True: 425k, False: 0]
  |  |  ------------------
  ------------------
 2537|   425k|                }
 2538|   710k|            }
 2539|       |
 2540|   710k|            i = win_h_x0;
 2541|   710k|            if (i < win_h_x1) {
  ------------------
  |  Branch (2541:17): [True: 710k, False: 0]
  ------------------
 2542|   710k|                OPJ_INT32 i_max = win_h_x1;
 2543|   710k|                if (i_max >= sn) {
  ------------------
  |  Branch (2543:21): [True: 58.9k, False: 651k]
  ------------------
 2544|  58.9k|                    i_max = sn - 1;
 2545|  58.9k|                }
 2546|   101M|                for (; i < i_max; i++) {
  ------------------
  |  Branch (2546:24): [True: 100M, False: 710k]
  ------------------
 2547|       |                    /* No bound checking */
 2548|   100M|                    OPJ_D(i) += (OPJ_S(i) + OPJ_S(i + 1)) >> 1;
  ------------------
  |  |  188|   100M|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
                                  OPJ_D(i) += (OPJ_S(i) + OPJ_S(i + 1)) >> 1;
  ------------------
  |  |  187|   100M|#define OPJ_S(i) a[(i)*2]
  ------------------
                                  OPJ_D(i) += (OPJ_S(i) + OPJ_S(i + 1)) >> 1;
  ------------------
  |  |  187|   100M|#define OPJ_S(i) a[(i)*2]
  ------------------
 2549|   100M|                }
 2550|   769k|                for (; i < win_h_x1; i++) {
  ------------------
  |  Branch (2550:24): [True: 58.9k, False: 710k]
  ------------------
 2551|       |                    /* Right-most case */
 2552|  58.9k|                    OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
  ------------------
  |  |  188|  58.9k|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
                                  OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
  ------------------
  |  |  189|  58.9k|#define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|      0|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |               #define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|      0|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |               #define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|  58.9k|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |  |  Branch (189:20): [True: 0, False: 58.9k]
  |  |  |  Branch (189:36): [True: 0, False: 58.9k]
  |  |  ------------------
  ------------------
                                  OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
  ------------------
  |  |  189|  58.9k|#define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|      0|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |               #define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|  58.9k|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |               #define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|      0|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |  |  Branch (189:20): [True: 0, False: 58.9k]
  |  |  |  Branch (189:36): [True: 58.9k, False: 0]
  |  |  ------------------
  ------------------
 2553|  58.9k|                }
 2554|   710k|            }
 2555|   710k|        }
 2556|  2.19M|    } else {
 2557|   131k|        if (!sn  && dn == 1) {        /* NEW :  CASE ONE ELEMENT */
  ------------------
  |  Branch (2557:13): [True: 37.5k, False: 94.0k]
  |  Branch (2557:21): [True: 15.5k, False: 22.0k]
  ------------------
 2558|  15.5k|            OPJ_S(0) /= 2;
  ------------------
  |  |  187|  15.5k|#define OPJ_S(i) a[(i)*2]
  ------------------
 2559|   116k|        } else {
 2560|  6.94M|            for (i = win_l_x0; i < win_l_x1; i++) {
  ------------------
  |  Branch (2560:32): [True: 6.82M, False: 116k]
  ------------------
 2561|  6.82M|                OPJ_D(i) = opj_int_sub_no_overflow(OPJ_D(i),
  ------------------
  |  |  188|  6.82M|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
                              OPJ_D(i) = opj_int_sub_no_overflow(OPJ_D(i),
  ------------------
  |  |  188|  6.82M|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
 2562|  6.82M|                                                   opj_int_add_no_overflow(opj_int_add_no_overflow(OPJ_SS_(i), OPJ_SS_(i + 1)),
  ------------------
  |  |  192|  6.82M|#define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|      0|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |               #define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|      0|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |               #define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|  6.82M|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |  |  Branch (192:21): [True: 0, False: 6.82M]
  |  |  |  Branch (192:37): [True: 0, False: 6.82M]
  |  |  ------------------
  ------------------
                                                                 opj_int_add_no_overflow(opj_int_add_no_overflow(OPJ_SS_(i), OPJ_SS_(i + 1)),
  ------------------
  |  |  192|  6.82M|#define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|      0|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |               #define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|  46.3k|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |               #define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  187|  6.78M|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |  |  Branch (192:21): [True: 0, False: 6.82M]
  |  |  |  Branch (192:37): [True: 46.3k, False: 6.78M]
  |  |  ------------------
  ------------------
 2563|  6.82M|                                                           2) >> 2);
 2564|  6.82M|            }
 2565|  6.98M|            for (i = win_h_x0; i < win_h_x1; i++) {
  ------------------
  |  Branch (2565:32): [True: 6.86M, False: 116k]
  ------------------
 2566|  6.86M|                OPJ_S(i) = opj_int_add_no_overflow(OPJ_S(i),
  ------------------
  |  |  187|  6.86M|#define OPJ_S(i) a[(i)*2]
  ------------------
                              OPJ_S(i) = opj_int_add_no_overflow(OPJ_S(i),
  ------------------
  |  |  187|  6.86M|#define OPJ_S(i) a[(i)*2]
  ------------------
 2567|  6.86M|                                                   opj_int_add_no_overflow(OPJ_DD_(i), OPJ_DD_(i - 1)) >> 1);
  ------------------
  |  |  193|  6.86M|#define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|  33.9k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|  6.83M|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (193:21): [True: 0, False: 6.86M]
  |  |  |  Branch (193:37): [True: 33.9k, False: 6.83M]
  |  |  ------------------
  ------------------
                                                                 opj_int_add_no_overflow(OPJ_DD_(i), OPJ_DD_(i - 1)) >> 1);
  ------------------
  |  |  193|  6.86M|#define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|  94.0k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |               #define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  188|  6.76M|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (193:21): [True: 94.0k, False: 6.76M]
  |  |  |  Branch (193:37): [True: 0, False: 6.76M]
  |  |  ------------------
  ------------------
 2568|  6.86M|            }
 2569|   116k|        }
 2570|   131k|    }
 2571|  2.32M|}
dwt.c:opj_dwt_interleave_partial_v:
 2478|   149k|{
 2479|   149k|    OPJ_BOOL ret;
 2480|   149k|    ret  = opj_sparse_array_int32_read(sa,
 2481|   149k|                                       sa_col, win_l_y0,
 2482|   149k|                                       sa_col + nb_cols, win_l_y1,
 2483|   149k|                                       dest + cas * 4 + 2 * 4 * win_l_y0,
 2484|   149k|                                       1, 2 * 4, OPJ_TRUE);
  ------------------
  |  |  117|   149k|#define OPJ_TRUE 1
  ------------------
 2485|   149k|    assert(ret);
 2486|   149k|    ret = opj_sparse_array_int32_read(sa,
 2487|   149k|                                      sa_col, sn + win_h_y0,
 2488|   149k|                                      sa_col + nb_cols, sn + win_h_y1,
 2489|   149k|                                      dest + (1 - cas) * 4 + 2 * 4 * win_h_y0,
 2490|   149k|                                      1, 2 * 4, OPJ_TRUE);
  ------------------
  |  |  117|   149k|#define OPJ_TRUE 1
  ------------------
 2491|   149k|    assert(ret);
 2492|   149k|    OPJ_UNUSED(ret);
  ------------------
  |  |  221|   149k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2493|   149k|}
dwt.c:opj_dwt_decode_partial_1_parallel:
 2588|   149k|{
 2589|   149k|    OPJ_INT32 i;
 2590|   149k|    OPJ_UINT32 off;
 2591|       |
 2592|   149k|    (void)nb_cols;
 2593|       |
 2594|   149k|    if (!cas) {
  ------------------
  |  Branch (2594:9): [True: 111k, False: 37.7k]
  ------------------
 2595|   111k|        if ((dn > 0) || (sn > 1)) { /* NEW :  CASE ONE ELEMENT */
  ------------------
  |  Branch (2595:13): [True: 108k, False: 2.96k]
  |  Branch (2595:25): [True: 0, False: 2.96k]
  ------------------
 2596|       |
 2597|       |            /* Naive version is :
 2598|       |            for (i = win_l_x0; i < i_max; i++) {
 2599|       |                OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
 2600|       |            }
 2601|       |            for (i = win_h_x0; i < win_h_x1; i++) {
 2602|       |                OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
 2603|       |            }
 2604|       |            but the compiler doesn't manage to unroll it to avoid bound
 2605|       |            checking in OPJ_S_ and OPJ_D_ macros
 2606|       |            */
 2607|       |
 2608|   108k|            i = win_l_x0;
 2609|   108k|            if (i < win_l_x1) {
  ------------------
  |  Branch (2609:17): [True: 108k, False: 0]
  ------------------
 2610|   108k|                OPJ_INT32 i_max;
 2611|       |
 2612|       |                /* Left-most case */
 2613|   544k|                for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2613:31): [True: 435k, False: 108k]
  ------------------
 2614|   435k|                    OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2573|   435k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
                                  OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2576|   435k|#define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|   435k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2576:28): [True: 435k, False: 0]
  |  |  |  Branch (2576:52): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                  OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2576|   435k|#define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|   435k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2576:28): [True: 0, False: 435k]
  |  |  |  Branch (2576:52): [True: 0, False: 435k]
  |  |  ------------------
  ------------------
 2615|   435k|                }
 2616|   108k|                i ++;
 2617|       |
 2618|   108k|                i_max = win_l_x1;
 2619|   108k|                if (i_max > dn) {
  ------------------
  |  Branch (2619:21): [True: 16.6k, False: 92.3k]
  ------------------
 2620|  16.6k|                    i_max = dn;
 2621|  16.6k|                }
 2622|       |
 2623|   108k|#ifdef __SSE2__
 2624|   108k|                if (i + 1 < i_max) {
  ------------------
  |  Branch (2624:21): [True: 105k, False: 3.77k]
  ------------------
 2625|   105k|                    const __m128i two = _mm_set1_epi32(2);
 2626|   105k|                    __m128i Dm1 = _mm_load_si128((__m128i * const)(a + 4 + (i - 1) * 8));
 2627|  13.0M|                    for (; i + 1 < i_max; i += 2) {
  ------------------
  |  Branch (2627:28): [True: 12.9M, False: 105k]
  ------------------
 2628|       |                        /* No bound checking */
 2629|  12.9M|                        __m128i S = _mm_load_si128((__m128i * const)(a + i * 8));
 2630|  12.9M|                        __m128i D = _mm_load_si128((__m128i * const)(a + 4 + i * 8));
 2631|  12.9M|                        __m128i S1 = _mm_load_si128((__m128i * const)(a + (i + 1) * 8));
 2632|  12.9M|                        __m128i D1 = _mm_load_si128((__m128i * const)(a + 4 + (i + 1) * 8));
 2633|  12.9M|                        S = _mm_sub_epi32(S,
 2634|  12.9M|                                          _mm_srai_epi32(_mm_add_epi32(_mm_add_epi32(Dm1, D), two), 2));
 2635|  12.9M|                        S1 = _mm_sub_epi32(S1,
 2636|  12.9M|                                           _mm_srai_epi32(_mm_add_epi32(_mm_add_epi32(D, D1), two), 2));
 2637|  12.9M|                        _mm_store_si128((__m128i*)(a + i * 8), S);
 2638|  12.9M|                        _mm_store_si128((__m128i*)(a + (i + 1) * 8), S1);
 2639|  12.9M|                        Dm1 = D1;
 2640|  12.9M|                    }
 2641|   105k|                }
 2642|   108k|#endif
 2643|       |
 2644|   191k|                for (; i < i_max; i++) {
  ------------------
  |  Branch (2644:24): [True: 82.3k, False: 108k]
  ------------------
 2645|       |                    /* No bound checking */
 2646|   411k|                    for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2646:35): [True: 329k, False: 82.3k]
  ------------------
 2647|   329k|                        OPJ_S_off(i, off) -= (OPJ_D_off(i - 1, off) + OPJ_D_off(i, off) + 2) >> 2;
  ------------------
  |  | 2573|   329k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
                                      OPJ_S_off(i, off) -= (OPJ_D_off(i - 1, off) + OPJ_D_off(i, off) + 2) >> 2;
  ------------------
  |  | 2574|   329k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
                                      OPJ_S_off(i, off) -= (OPJ_D_off(i - 1, off) + OPJ_D_off(i, off) + 2) >> 2;
  ------------------
  |  | 2574|   329k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
 2648|   329k|                    }
 2649|  82.3k|                }
 2650|   125k|                for (; i < win_l_x1; i++) {
  ------------------
  |  Branch (2650:24): [True: 16.6k, False: 108k]
  ------------------
 2651|       |                    /* Right-most case */
 2652|  83.0k|                    for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2652:35): [True: 66.4k, False: 16.6k]
  ------------------
 2653|  66.4k|                        OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2573|  66.4k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
                                      OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2576|  66.4k|#define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|  66.4k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2576:28): [True: 0, False: 66.4k]
  |  |  |  Branch (2576:52): [True: 0, False: 66.4k]
  |  |  ------------------
  ------------------
                                      OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2576|  66.4k|#define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|  66.4k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_D__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=dn?OPJ_D_off(dn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2576:28): [True: 0, False: 66.4k]
  |  |  |  Branch (2576:52): [True: 66.4k, False: 0]
  |  |  ------------------
  ------------------
 2654|  66.4k|                    }
 2655|  16.6k|                }
 2656|   108k|            }
 2657|       |
 2658|   108k|            i = win_h_x0;
 2659|   108k|            if (i < win_h_x1) {
  ------------------
  |  Branch (2659:17): [True: 108k, False: 0]
  ------------------
 2660|   108k|                OPJ_INT32 i_max = win_h_x1;
 2661|   108k|                if (i_max >= sn) {
  ------------------
  |  Branch (2661:21): [True: 11.6k, False: 97.3k]
  ------------------
 2662|  11.6k|                    i_max = sn - 1;
 2663|  11.6k|                }
 2664|       |
 2665|   108k|#ifdef __SSE2__
 2666|   108k|                if (i + 1 < i_max) {
  ------------------
  |  Branch (2666:21): [True: 105k, False: 3.21k]
  ------------------
 2667|   105k|                    __m128i S =  _mm_load_si128((__m128i * const)(a + i * 8));
 2668|  13.1M|                    for (; i + 1 < i_max; i += 2) {
  ------------------
  |  Branch (2668:28): [True: 13.0M, False: 105k]
  ------------------
 2669|       |                        /* No bound checking */
 2670|  13.0M|                        __m128i D = _mm_load_si128((__m128i * const)(a + 4 + i * 8));
 2671|  13.0M|                        __m128i S1 = _mm_load_si128((__m128i * const)(a + (i + 1) * 8));
 2672|  13.0M|                        __m128i D1 = _mm_load_si128((__m128i * const)(a + 4 + (i + 1) * 8));
 2673|  13.0M|                        __m128i S2 = _mm_load_si128((__m128i * const)(a + (i + 2) * 8));
 2674|  13.0M|                        D = _mm_add_epi32(D, _mm_srai_epi32(_mm_add_epi32(S, S1), 1));
 2675|  13.0M|                        D1 = _mm_add_epi32(D1, _mm_srai_epi32(_mm_add_epi32(S1, S2), 1));
 2676|  13.0M|                        _mm_store_si128((__m128i*)(a + 4 + i * 8), D);
 2677|  13.0M|                        _mm_store_si128((__m128i*)(a + 4 + (i + 1) * 8), D1);
 2678|  13.0M|                        S = S2;
 2679|  13.0M|                    }
 2680|   105k|                }
 2681|   108k|#endif
 2682|       |
 2683|   124k|                for (; i < i_max; i++) {
  ------------------
  |  Branch (2683:24): [True: 15.7k, False: 108k]
  ------------------
 2684|       |                    /* No bound checking */
 2685|  78.7k|                    for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2685:35): [True: 62.9k, False: 15.7k]
  ------------------
 2686|  62.9k|                        OPJ_D_off(i, off) += (OPJ_S_off(i, off) + OPJ_S_off(i + 1, off)) >> 1;
  ------------------
  |  | 2574|  62.9k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
                                      OPJ_D_off(i, off) += (OPJ_S_off(i, off) + OPJ_S_off(i + 1, off)) >> 1;
  ------------------
  |  | 2573|  62.9k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
                                      OPJ_D_off(i, off) += (OPJ_S_off(i, off) + OPJ_S_off(i + 1, off)) >> 1;
  ------------------
  |  | 2573|  62.9k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
 2687|  62.9k|                    }
 2688|  15.7k|                }
 2689|   120k|                for (; i < win_h_x1; i++) {
  ------------------
  |  Branch (2689:24): [True: 11.6k, False: 108k]
  ------------------
 2690|       |                    /* Right-most case */
 2691|  58.2k|                    for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2691:35): [True: 46.6k, False: 11.6k]
  ------------------
 2692|  46.6k|                        OPJ_D_off(i, off) += (OPJ_S__off(i, off) + OPJ_S__off(i + 1, off)) >> 1;
  ------------------
  |  | 2574|  46.6k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
                                      OPJ_D_off(i, off) += (OPJ_S__off(i, off) + OPJ_S__off(i + 1, off)) >> 1;
  ------------------
  |  | 2575|  46.6k|#define OPJ_S__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=sn?OPJ_S_off(sn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|      0|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |               #define OPJ_S__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=sn?OPJ_S_off(sn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|      0|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |               #define OPJ_S__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=sn?OPJ_S_off(sn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|  46.6k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |  |  Branch (2575:28): [True: 0, False: 46.6k]
  |  |  |  Branch (2575:52): [True: 0, False: 46.6k]
  |  |  ------------------
  ------------------
                                      OPJ_D_off(i, off) += (OPJ_S__off(i, off) + OPJ_S__off(i + 1, off)) >> 1;
  ------------------
  |  | 2575|  46.6k|#define OPJ_S__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=sn?OPJ_S_off(sn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|      0|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |               #define OPJ_S__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=sn?OPJ_S_off(sn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|  46.6k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |               #define OPJ_S__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=sn?OPJ_S_off(sn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|      0|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |  |  Branch (2575:28): [True: 0, False: 46.6k]
  |  |  |  Branch (2575:52): [True: 46.6k, False: 0]
  |  |  ------------------
  ------------------
 2693|  46.6k|                    }
 2694|  11.6k|                }
 2695|   108k|            }
 2696|   108k|        }
 2697|   111k|    } else {
 2698|  37.7k|        if (!sn  && dn == 1) {        /* NEW :  CASE ONE ELEMENT */
  ------------------
  |  Branch (2698:13): [True: 2.41k, False: 35.3k]
  |  Branch (2698:21): [True: 1.25k, False: 1.16k]
  ------------------
 2699|  6.28k|            for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2699:27): [True: 5.02k, False: 1.25k]
  ------------------
 2700|  5.02k|                OPJ_S_off(0, off) /= 2;
  ------------------
  |  | 2573|  5.02k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
 2701|  5.02k|            }
 2702|  36.5k|        } else {
 2703|  1.92M|            for (i = win_l_x0; i < win_l_x1; i++) {
  ------------------
  |  Branch (2703:32): [True: 1.88M, False: 36.5k]
  ------------------
 2704|  9.44M|                for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2704:31): [True: 7.55M, False: 1.88M]
  ------------------
 2705|  7.55M|                    OPJ_D_off(i, off) = opj_int_sub_no_overflow(
  ------------------
  |  | 2574|  7.55M|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
 2706|  7.55M|                                            OPJ_D_off(i, off),
  ------------------
  |  | 2574|  7.55M|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
 2707|  7.55M|                                            opj_int_add_no_overflow(
 2708|  7.55M|                                                opj_int_add_no_overflow(OPJ_SS__off(i, off), OPJ_SS__off(i + 1, off)), 2) >> 2);
  ------------------
  |  | 2577|  7.55M|#define OPJ_SS__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=dn?OPJ_S_off(dn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|      0|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |               #define OPJ_SS__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=dn?OPJ_S_off(dn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|      0|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |               #define OPJ_SS__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=dn?OPJ_S_off(dn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|  7.55M|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |  |  Branch (2577:29): [True: 0, False: 7.55M]
  |  |  |  Branch (2577:53): [True: 0, False: 7.55M]
  |  |  ------------------
  ------------------
                                                              opj_int_add_no_overflow(OPJ_SS__off(i, off), OPJ_SS__off(i + 1, off)), 2) >> 2);
  ------------------
  |  | 2577|  7.55M|#define OPJ_SS__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=dn?OPJ_S_off(dn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|      0|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |               #define OPJ_SS__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=dn?OPJ_S_off(dn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|  24.4k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |               #define OPJ_SS__off(i,off) ((i)<0?OPJ_S_off(0,off):((i)>=dn?OPJ_S_off(dn-1,off):OPJ_S_off(i,off)))
  |  |  ------------------
  |  |  |  | 2573|  7.52M|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |  |  Branch (2577:29): [True: 0, False: 7.55M]
  |  |  |  Branch (2577:53): [True: 24.4k, False: 7.52M]
  |  |  ------------------
  ------------------
 2709|  7.55M|                }
 2710|  1.88M|            }
 2711|  1.93M|            for (i = win_h_x0; i < win_h_x1; i++) {
  ------------------
  |  Branch (2711:32): [True: 1.89M, False: 36.5k]
  ------------------
 2712|  9.49M|                for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2712:31): [True: 7.59M, False: 1.89M]
  ------------------
 2713|  7.59M|                    OPJ_S_off(i, off) = opj_int_add_no_overflow(
  ------------------
  |  | 2573|  7.59M|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
 2714|  7.59M|                                            OPJ_S_off(i, off),
  ------------------
  |  | 2573|  7.59M|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
 2715|  7.59M|                                            opj_int_add_no_overflow(OPJ_DD__off(i, off), OPJ_DD__off(i - 1, off)) >> 1);
  ------------------
  |  | 2578|  7.59M|#define OPJ_DD__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=sn?OPJ_D_off(sn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_DD__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=sn?OPJ_D_off(sn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|  19.6k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_DD__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=sn?OPJ_D_off(sn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|  7.57M|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2578:29): [True: 0, False: 7.59M]
  |  |  |  Branch (2578:53): [True: 19.6k, False: 7.57M]
  |  |  ------------------
  ------------------
                                                          opj_int_add_no_overflow(OPJ_DD__off(i, off), OPJ_DD__off(i - 1, off)) >> 1);
  ------------------
  |  | 2578|  7.59M|#define OPJ_DD__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=sn?OPJ_D_off(sn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|   141k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_DD__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=sn?OPJ_D_off(sn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |               #define OPJ_DD__off(i,off) ((i)<0?OPJ_D_off(0,off):((i)>=sn?OPJ_D_off(sn-1,off):OPJ_D_off(i,off)))
  |  |  ------------------
  |  |  |  | 2574|  7.45M|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2578:29): [True: 141k, False: 7.45M]
  |  |  |  Branch (2578:53): [True: 0, False: 7.45M]
  |  |  ------------------
  ------------------
 2716|  7.59M|                }
 2717|  1.89M|            }
 2718|  36.5k|        }
 2719|  37.7k|    }
 2720|   149k|}
dwt.c:opj_dwt_decode_tile_97:
 3516|  1.55k|{
 3517|  1.55k|    opj_v8dwt_t h;
 3518|  1.55k|    opj_v8dwt_t v;
 3519|       |
 3520|  1.55k|    opj_tcd_resolution_t* res = tilec->resolutions;
 3521|       |
 3522|  1.55k|    OPJ_UINT32 rw = (OPJ_UINT32)(res->x1 -
 3523|  1.55k|                                 res->x0);    /* width of the resolution level computed */
 3524|  1.55k|    OPJ_UINT32 rh = (OPJ_UINT32)(res->y1 -
 3525|  1.55k|                                 res->y0);    /* height of the resolution level computed */
 3526|       |
 3527|  1.55k|    OPJ_UINT32 w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions -
 3528|  1.55k|                                                               1].x1 -
 3529|  1.55k|                                tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 3530|       |
 3531|  1.55k|    OPJ_SIZE_T l_data_size;
 3532|  1.55k|    const int num_threads = opj_thread_pool_get_thread_count(tp);
 3533|       |
 3534|  1.55k|    if (numres == 1) {
  ------------------
  |  Branch (3534:9): [True: 706, False: 845]
  ------------------
 3535|    706|        return OPJ_TRUE;
  ------------------
  |  |  117|    706|#define OPJ_TRUE 1
  ------------------
 3536|    706|    }
 3537|       |
 3538|    845|    l_data_size = opj_dwt_max_resolution(res, numres);
 3539|       |    /* overflow check */
 3540|    845|    if (l_data_size > (SIZE_MAX / sizeof(opj_v8_t))) {
  ------------------
  |  Branch (3540:9): [True: 0, False: 845]
  ------------------
 3541|       |        /* FIXME event manager error callback */
 3542|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3543|      0|    }
 3544|    845|    h.wavelet = (opj_v8_t*) opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3545|    845|    if (!h.wavelet) {
  ------------------
  |  Branch (3545:9): [True: 0, False: 845]
  ------------------
 3546|       |        /* FIXME event manager error callback */
 3547|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3548|      0|    }
 3549|    845|    v.wavelet = h.wavelet;
 3550|       |
 3551|  13.1k|    while (--numres) {
  ------------------
  |  Branch (3551:12): [True: 12.3k, False: 845]
  ------------------
 3552|  12.3k|        OPJ_FLOAT32 * OPJ_RESTRICT aj = (OPJ_FLOAT32*) tilec->data;
 3553|  12.3k|        OPJ_UINT32 j;
 3554|       |
 3555|  12.3k|        h.sn = (OPJ_INT32)rw;
 3556|  12.3k|        v.sn = (OPJ_INT32)rh;
 3557|       |
 3558|  12.3k|        ++res;
 3559|       |
 3560|  12.3k|        rw = (OPJ_UINT32)(res->x1 -
 3561|  12.3k|                          res->x0);   /* width of the resolution level computed */
 3562|  12.3k|        rh = (OPJ_UINT32)(res->y1 -
 3563|  12.3k|                          res->y0);   /* height of the resolution level computed */
 3564|       |
 3565|  12.3k|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 3566|  12.3k|        h.cas = res->x0 % 2;
 3567|       |
 3568|  12.3k|        h.win_l_x0 = 0;
 3569|  12.3k|        h.win_l_x1 = (OPJ_UINT32)h.sn;
 3570|  12.3k|        h.win_h_x0 = 0;
 3571|  12.3k|        h.win_h_x1 = (OPJ_UINT32)h.dn;
 3572|       |
 3573|  12.3k|        if (num_threads <= 1 || rh < 2 * NB_ELTS_V8) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3573:13): [True: 12.3k, False: 0]
  |  Branch (3573:33): [True: 0, False: 0]
  ------------------
 3574|  33.0k|            for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   93|  33.0k|#define NB_ELTS_V8  8
  ------------------
                          for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   93|  20.7k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3574:25): [True: 20.7k, False: 12.3k]
  ------------------
 3575|  20.7k|                OPJ_UINT32 k;
 3576|  20.7k|                opj_v8dwt_interleave_h(&h, aj, w, NB_ELTS_V8);
  ------------------
  |  |   93|  20.7k|#define NB_ELTS_V8  8
  ------------------
 3577|  20.7k|                opj_v8dwt_decode(&h);
 3578|       |
 3579|       |                /* To be adapted if NB_ELTS_V8 changes */
 3580|  2.64M|                for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3580:29): [True: 2.61M, False: 20.7k]
  ------------------
 3581|  2.61M|                    aj[k      ] = h.wavelet[k].f[0];
 3582|  2.61M|                    aj[k + (OPJ_SIZE_T)w  ] = h.wavelet[k].f[1];
 3583|  2.61M|                    aj[k + (OPJ_SIZE_T)w * 2] = h.wavelet[k].f[2];
 3584|  2.61M|                    aj[k + (OPJ_SIZE_T)w * 3] = h.wavelet[k].f[3];
 3585|  2.61M|                }
 3586|  2.64M|                for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3586:29): [True: 2.61M, False: 20.7k]
  ------------------
 3587|  2.61M|                    aj[k + (OPJ_SIZE_T)w * 4] = h.wavelet[k].f[4];
 3588|  2.61M|                    aj[k + (OPJ_SIZE_T)w * 5] = h.wavelet[k].f[5];
 3589|  2.61M|                    aj[k + (OPJ_SIZE_T)w * 6] = h.wavelet[k].f[6];
 3590|  2.61M|                    aj[k + (OPJ_SIZE_T)w * 7] = h.wavelet[k].f[7];
 3591|  2.61M|                }
 3592|       |
 3593|  20.7k|                aj += w * NB_ELTS_V8;
  ------------------
  |  |   93|  20.7k|#define NB_ELTS_V8  8
  ------------------
 3594|  20.7k|            }
 3595|  12.3k|        } else {
 3596|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 3597|      0|            OPJ_UINT32 step_j;
 3598|       |
 3599|      0|            if ((rh / NB_ELTS_V8) < num_jobs) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3599:17): [True: 0, False: 0]
  ------------------
 3600|      0|                num_jobs = rh / NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3601|      0|            }
 3602|      0|            step_j = ((rh / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
                          step_j = ((rh / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3603|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (3603:25): [True: 0, False: 0]
  ------------------
 3604|      0|                opj_dwt97_decode_h_job_t* job;
 3605|       |
 3606|      0|                job = (opj_dwt97_decode_h_job_t*) opj_malloc(sizeof(opj_dwt97_decode_h_job_t));
 3607|      0|                if (!job) {
  ------------------
  |  Branch (3607:21): [True: 0, False: 0]
  ------------------
 3608|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3609|      0|                    opj_aligned_free(h.wavelet);
 3610|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3611|      0|                }
 3612|      0|                job->h.wavelet = (opj_v8_t*)opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3613|      0|                if (!job->h.wavelet) {
  ------------------
  |  Branch (3613:21): [True: 0, False: 0]
  ------------------
 3614|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3615|      0|                    opj_free(job);
 3616|      0|                    opj_aligned_free(h.wavelet);
 3617|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3618|      0|                }
 3619|      0|                job->h.dn = h.dn;
 3620|      0|                job->h.sn = h.sn;
 3621|      0|                job->h.cas = h.cas;
 3622|      0|                job->h.win_l_x0 = h.win_l_x0;
 3623|      0|                job->h.win_l_x1 = h.win_l_x1;
 3624|      0|                job->h.win_h_x0 = h.win_h_x0;
 3625|      0|                job->h.win_h_x1 = h.win_h_x1;
 3626|      0|                job->rw = rw;
 3627|      0|                job->w = w;
 3628|      0|                job->aj = aj;
 3629|      0|                job->nb_rows = (j + 1 == num_jobs) ? (rh & (OPJ_UINT32)~
  ------------------
  |  Branch (3629:32): [True: 0, False: 0]
  ------------------
 3630|      0|                                                      (NB_ELTS_V8 - 1)) - j * step_j : step_j;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3631|      0|                aj += w * job->nb_rows;
 3632|      0|                opj_thread_pool_submit_job(tp, opj_dwt97_decode_h_func, job);
 3633|      0|            }
 3634|      0|            opj_thread_pool_wait_completion(tp, 0);
 3635|      0|            j = rh & (OPJ_UINT32)~(NB_ELTS_V8 - 1);
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3636|      0|        }
 3637|       |
 3638|  12.3k|        if (j < rh) {
  ------------------
  |  Branch (3638:13): [True: 6.91k, False: 5.41k]
  ------------------
 3639|  6.91k|            OPJ_UINT32 k;
 3640|  6.91k|            opj_v8dwt_interleave_h(&h, aj, w, rh - j);
 3641|  6.91k|            opj_v8dwt_decode(&h);
 3642|   154k|            for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3642:25): [True: 148k, False: 6.91k]
  ------------------
 3643|   148k|                OPJ_UINT32 l;
 3644|   579k|                for (l = 0; l < rh - j; l++) {
  ------------------
  |  Branch (3644:29): [True: 431k, False: 148k]
  ------------------
 3645|   431k|                    aj[k + (OPJ_SIZE_T)w  * l ] = h.wavelet[k].f[l];
 3646|   431k|                }
 3647|   148k|            }
 3648|  6.91k|        }
 3649|       |
 3650|  12.3k|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 3651|  12.3k|        v.cas = res->y0 % 2;
 3652|  12.3k|        v.win_l_x0 = 0;
 3653|  12.3k|        v.win_l_x1 = (OPJ_UINT32)v.sn;
 3654|  12.3k|        v.win_h_x0 = 0;
 3655|  12.3k|        v.win_h_x1 = (OPJ_UINT32)v.dn;
 3656|       |
 3657|  12.3k|        aj = (OPJ_FLOAT32*) tilec->data;
 3658|  12.3k|        if (num_threads <= 1 || rw < 2 * NB_ELTS_V8) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3658:13): [True: 12.3k, False: 0]
  |  Branch (3658:33): [True: 0, False: 0]
  ------------------
 3659|  30.2k|            for (j = rw; j > (NB_ELTS_V8 - 1); j -= NB_ELTS_V8) {
  ------------------
  |  |   93|  30.2k|#define NB_ELTS_V8  8
  ------------------
                          for (j = rw; j > (NB_ELTS_V8 - 1); j -= NB_ELTS_V8) {
  ------------------
  |  |   93|  17.9k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3659:26): [True: 17.9k, False: 12.3k]
  ------------------
 3660|  17.9k|                OPJ_UINT32 k;
 3661|       |
 3662|  17.9k|                opj_v8dwt_interleave_v(&v, aj, w, NB_ELTS_V8);
  ------------------
  |  |   93|  17.9k|#define NB_ELTS_V8  8
  ------------------
 3663|  17.9k|                opj_v8dwt_decode(&v);
 3664|       |
 3665|  2.64M|                for (k = 0; k < rh; ++k) {
  ------------------
  |  Branch (3665:29): [True: 2.63M, False: 17.9k]
  ------------------
 3666|  2.63M|                    memcpy(&aj[k * (OPJ_SIZE_T)w], &v.wavelet[k], NB_ELTS_V8 * sizeof(OPJ_FLOAT32));
  ------------------
  |  |   93|  2.63M|#define NB_ELTS_V8  8
  ------------------
 3667|  2.63M|                }
 3668|  17.9k|                aj += NB_ELTS_V8;
  ------------------
  |  |   93|  17.9k|#define NB_ELTS_V8  8
  ------------------
 3669|  17.9k|            }
 3670|  12.3k|        } else {
 3671|       |            /* "bench_dwt -I" shows that scaling is poor, likely due to RAM
 3672|       |                transfer being the limiting factor. So limit the number of
 3673|       |                threads.
 3674|       |             */
 3675|      0|            OPJ_UINT32 num_jobs = opj_uint_max((OPJ_UINT32)num_threads / 2, 2U);
 3676|      0|            OPJ_UINT32 step_j;
 3677|       |
 3678|      0|            if ((rw / NB_ELTS_V8) < num_jobs) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3678:17): [True: 0, False: 0]
  ------------------
 3679|      0|                num_jobs = rw / NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3680|      0|            }
 3681|      0|            step_j = ((rw / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
                          step_j = ((rw / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3682|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (3682:25): [True: 0, False: 0]
  ------------------
 3683|      0|                opj_dwt97_decode_v_job_t* job;
 3684|       |
 3685|      0|                job = (opj_dwt97_decode_v_job_t*) opj_malloc(sizeof(opj_dwt97_decode_v_job_t));
 3686|      0|                if (!job) {
  ------------------
  |  Branch (3686:21): [True: 0, False: 0]
  ------------------
 3687|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3688|      0|                    opj_aligned_free(h.wavelet);
 3689|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3690|      0|                }
 3691|      0|                job->v.wavelet = (opj_v8_t*)opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3692|      0|                if (!job->v.wavelet) {
  ------------------
  |  Branch (3692:21): [True: 0, False: 0]
  ------------------
 3693|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3694|      0|                    opj_free(job);
 3695|      0|                    opj_aligned_free(h.wavelet);
 3696|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3697|      0|                }
 3698|      0|                job->v.dn = v.dn;
 3699|      0|                job->v.sn = v.sn;
 3700|      0|                job->v.cas = v.cas;
 3701|      0|                job->v.win_l_x0 = v.win_l_x0;
 3702|      0|                job->v.win_l_x1 = v.win_l_x1;
 3703|      0|                job->v.win_h_x0 = v.win_h_x0;
 3704|      0|                job->v.win_h_x1 = v.win_h_x1;
 3705|      0|                job->rh = rh;
 3706|      0|                job->w = w;
 3707|      0|                job->aj = aj;
 3708|      0|                job->nb_columns = (j + 1 == num_jobs) ? (rw & (OPJ_UINT32)~
  ------------------
  |  Branch (3708:35): [True: 0, False: 0]
  ------------------
 3709|      0|                                  (NB_ELTS_V8 - 1)) - j * step_j : step_j;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3710|      0|                aj += job->nb_columns;
 3711|      0|                opj_thread_pool_submit_job(tp, opj_dwt97_decode_v_func, job);
 3712|      0|            }
 3713|      0|            opj_thread_pool_wait_completion(tp, 0);
 3714|      0|        }
 3715|       |
 3716|  12.3k|        if (rw & (NB_ELTS_V8 - 1)) {
  ------------------
  |  |   93|  12.3k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3716:13): [True: 5.01k, False: 7.31k]
  ------------------
 3717|  5.01k|            OPJ_UINT32 k;
 3718|       |
 3719|  5.01k|            j = rw & (NB_ELTS_V8 - 1);
  ------------------
  |  |   93|  5.01k|#define NB_ELTS_V8  8
  ------------------
 3720|       |
 3721|  5.01k|            opj_v8dwt_interleave_v(&v, aj, w, j);
 3722|  5.01k|            opj_v8dwt_decode(&v);
 3723|       |
 3724|   164k|            for (k = 0; k < rh; ++k) {
  ------------------
  |  Branch (3724:25): [True: 159k, False: 5.01k]
  ------------------
 3725|   159k|                memcpy(&aj[k * (OPJ_SIZE_T)w], &v.wavelet[k],
 3726|   159k|                       (OPJ_SIZE_T)j * sizeof(OPJ_FLOAT32));
 3727|   159k|            }
 3728|  5.01k|        }
 3729|  12.3k|    }
 3730|       |
 3731|    845|    opj_aligned_free(h.wavelet);
 3732|    845|    return OPJ_TRUE;
  ------------------
  |  |  117|    845|#define OPJ_TRUE 1
  ------------------
 3733|    845|}
dwt.c:opj_v8dwt_interleave_h:
 3081|  27.6k|{
 3082|  27.6k|    OPJ_FLOAT32* OPJ_RESTRICT bi = (OPJ_FLOAT32*)(dwt->wavelet + dwt->cas);
 3083|  27.6k|    OPJ_UINT32 i, k;
 3084|  27.6k|    OPJ_UINT32 x0 = dwt->win_l_x0;
 3085|  27.6k|    OPJ_UINT32 x1 = dwt->win_l_x1;
 3086|       |
 3087|  83.0k|    for (k = 0; k < 2; ++k) {
  ------------------
  |  Branch (3087:17): [True: 55.3k, False: 27.6k]
  ------------------
 3088|  55.3k|        if (remaining_height >= NB_ELTS_V8 && ((OPJ_SIZE_T) a & 0x0f) == 0 &&
  ------------------
  |  |   93|   110k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3088:13): [True: 41.5k, False: 13.8k]
  |  Branch (3088:47): [True: 23.5k, False: 17.9k]
  ------------------
 3089|  55.3k|                ((OPJ_SIZE_T) bi & 0x0f) == 0) {
  ------------------
  |  Branch (3089:17): [True: 23.5k, False: 0]
  ------------------
 3090|       |            /* Fast code path */
 3091|  1.80M|            for (i = x0; i < x1; ++i) {
  ------------------
  |  Branch (3091:26): [True: 1.77M, False: 23.5k]
  ------------------
 3092|  1.77M|                OPJ_UINT32 j = i;
 3093|  1.77M|                OPJ_FLOAT32* OPJ_RESTRICT dst = bi + i * 2 * NB_ELTS_V8;
  ------------------
  |  |   93|  1.77M|#define NB_ELTS_V8  8
  ------------------
 3094|  1.77M|                dst[0] = a[j];
 3095|  1.77M|                j += width;
 3096|  1.77M|                dst[1] = a[j];
 3097|  1.77M|                j += width;
 3098|  1.77M|                dst[2] = a[j];
 3099|  1.77M|                j += width;
 3100|  1.77M|                dst[3] = a[j];
 3101|  1.77M|                j += width;
 3102|  1.77M|                dst[4] = a[j];
 3103|  1.77M|                j += width;
 3104|  1.77M|                dst[5] = a[j];
 3105|  1.77M|                j += width;
 3106|  1.77M|                dst[6] = a[j];
 3107|  1.77M|                j += width;
 3108|  1.77M|                dst[7] = a[j];
 3109|  1.77M|            }
 3110|  31.8k|        } else {
 3111|       |            /* Slow code path */
 3112|  1.01M|            for (i = x0; i < x1; ++i) {
  ------------------
  |  Branch (3112:26): [True: 988k, False: 31.8k]
  ------------------
 3113|   988k|                OPJ_UINT32 j = i;
 3114|   988k|                OPJ_FLOAT32* OPJ_RESTRICT dst = bi + i * 2 * NB_ELTS_V8;
  ------------------
  |  |   93|   988k|#define NB_ELTS_V8  8
  ------------------
 3115|   988k|                dst[0] = a[j];
 3116|   988k|                j += width;
 3117|   988k|                if (remaining_height == 1) {
  ------------------
  |  Branch (3117:21): [True: 68.4k, False: 919k]
  ------------------
 3118|  68.4k|                    continue;
 3119|  68.4k|                }
 3120|   919k|                dst[1] = a[j];
 3121|   919k|                j += width;
 3122|   919k|                if (remaining_height == 2) {
  ------------------
  |  Branch (3122:21): [True: 15.4k, False: 904k]
  ------------------
 3123|  15.4k|                    continue;
 3124|  15.4k|                }
 3125|   904k|                dst[2] = a[j];
 3126|   904k|                j += width;
 3127|   904k|                if (remaining_height == 3) {
  ------------------
  |  Branch (3127:21): [True: 3.49k, False: 900k]
  ------------------
 3128|  3.49k|                    continue;
 3129|  3.49k|                }
 3130|   900k|                dst[3] = a[j];
 3131|   900k|                j += width;
 3132|   900k|                if (remaining_height == 4) {
  ------------------
  |  Branch (3132:21): [True: 25.6k, False: 874k]
  ------------------
 3133|  25.6k|                    continue;
 3134|  25.6k|                }
 3135|   874k|                dst[4] = a[j];
 3136|   874k|                j += width;
 3137|   874k|                if (remaining_height == 5) {
  ------------------
  |  Branch (3137:21): [True: 10.5k, False: 864k]
  ------------------
 3138|  10.5k|                    continue;
 3139|  10.5k|                }
 3140|   864k|                dst[5] = a[j];
 3141|   864k|                j += width;
 3142|   864k|                if (remaining_height == 6) {
  ------------------
  |  Branch (3142:21): [True: 4.98k, False: 859k]
  ------------------
 3143|  4.98k|                    continue;
 3144|  4.98k|                }
 3145|   859k|                dst[6] = a[j];
 3146|   859k|                j += width;
 3147|   859k|                if (remaining_height == 7) {
  ------------------
  |  Branch (3147:21): [True: 19.4k, False: 839k]
  ------------------
 3148|  19.4k|                    continue;
 3149|  19.4k|                }
 3150|   839k|                dst[7] = a[j];
 3151|   839k|            }
 3152|  31.8k|        }
 3153|       |
 3154|  55.3k|        bi = (OPJ_FLOAT32*)(dwt->wavelet + 1 - dwt->cas);
 3155|  55.3k|        a += dwt->sn;
 3156|  55.3k|        x0 = dwt->win_h_x0;
 3157|  55.3k|        x1 = dwt->win_h_x1;
 3158|  55.3k|    }
 3159|  27.6k|}
dwt.c:opj_v8dwt_decode:
 3354|   130k|{
 3355|   130k|    OPJ_INT32 a, b;
 3356|       |    /* BUG_WEIRD_TWO_INVK (look for this identifier in tcd.c) */
 3357|       |    /* Historic value for 2 / opj_invK */
 3358|       |    /* Normally, we should use invK, but if we do so, we have failures in the */
 3359|       |    /* conformance test, due to MSE and peak errors significantly higher than */
 3360|       |    /* accepted value */
 3361|       |    /* Due to using two_invK instead of invK, we have to compensate in tcd.c */
 3362|       |    /* the computation of the stepsize for the non LL subbands */
 3363|   130k|    const float two_invK = 1.625732422f;
 3364|   130k|    if (dwt->cas == 0) {
  ------------------
  |  Branch (3364:9): [True: 100k, False: 30.2k]
  ------------------
 3365|   100k|        if (!((dwt->dn > 0) || (dwt->sn > 1))) {
  ------------------
  |  Branch (3365:15): [True: 96.3k, False: 4.36k]
  |  Branch (3365:32): [True: 0, False: 4.36k]
  ------------------
 3366|  4.36k|            return;
 3367|  4.36k|        }
 3368|  96.3k|        a = 0;
 3369|  96.3k|        b = 1;
 3370|  96.3k|    } else {
 3371|  30.2k|        if (!((dwt->sn > 0) || (dwt->dn > 1))) {
  ------------------
  |  Branch (3371:15): [True: 24.7k, False: 5.50k]
  |  Branch (3371:32): [True: 0, False: 5.50k]
  ------------------
 3372|  5.50k|            return;
 3373|  5.50k|        }
 3374|  24.7k|        a = 1;
 3375|  24.7k|        b = 0;
 3376|  24.7k|    }
 3377|   121k|#ifdef __SSE__
 3378|   121k|    opj_v8dwt_decode_step1_sse(dwt->wavelet + a, dwt->win_l_x0, dwt->win_l_x1,
 3379|   121k|                               _mm_set1_ps(opj_K));
 3380|   121k|    opj_v8dwt_decode_step1_sse(dwt->wavelet + b, dwt->win_h_x0, dwt->win_h_x1,
 3381|   121k|                               _mm_set1_ps(two_invK));
 3382|   121k|    opj_v8dwt_decode_step2_sse(dwt->wavelet + b, dwt->wavelet + a + 1,
 3383|   121k|                               dwt->win_l_x0, dwt->win_l_x1,
 3384|   121k|                               (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3385|   121k|                               _mm_set1_ps(-opj_dwt_delta));
 3386|   121k|    opj_v8dwt_decode_step2_sse(dwt->wavelet + a, dwt->wavelet + b + 1,
 3387|   121k|                               dwt->win_h_x0, dwt->win_h_x1,
 3388|   121k|                               (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3389|   121k|                               _mm_set1_ps(-opj_dwt_gamma));
 3390|   121k|    opj_v8dwt_decode_step2_sse(dwt->wavelet + b, dwt->wavelet + a + 1,
 3391|   121k|                               dwt->win_l_x0, dwt->win_l_x1,
 3392|   121k|                               (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3393|   121k|                               _mm_set1_ps(-opj_dwt_beta));
 3394|   121k|    opj_v8dwt_decode_step2_sse(dwt->wavelet + a, dwt->wavelet + b + 1,
 3395|   121k|                               dwt->win_h_x0, dwt->win_h_x1,
 3396|   121k|                               (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3397|   121k|                               _mm_set1_ps(-opj_dwt_alpha));
 3398|       |#else
 3399|       |    opj_v8dwt_decode_step1(dwt->wavelet + a, dwt->win_l_x0, dwt->win_l_x1,
 3400|       |                           opj_K);
 3401|       |    opj_v8dwt_decode_step1(dwt->wavelet + b, dwt->win_h_x0, dwt->win_h_x1,
 3402|       |                           two_invK);
 3403|       |    opj_v8dwt_decode_step2(dwt->wavelet + b, dwt->wavelet + a + 1,
 3404|       |                           dwt->win_l_x0, dwt->win_l_x1,
 3405|       |                           (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3406|       |                           -opj_dwt_delta);
 3407|       |    opj_v8dwt_decode_step2(dwt->wavelet + a, dwt->wavelet + b + 1,
 3408|       |                           dwt->win_h_x0, dwt->win_h_x1,
 3409|       |                           (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3410|       |                           -opj_dwt_gamma);
 3411|       |    opj_v8dwt_decode_step2(dwt->wavelet + b, dwt->wavelet + a + 1,
 3412|       |                           dwt->win_l_x0, dwt->win_l_x1,
 3413|       |                           (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3414|       |                           -opj_dwt_beta);
 3415|       |    opj_v8dwt_decode_step2(dwt->wavelet + a, dwt->wavelet + b + 1,
 3416|       |                           dwt->win_h_x0, dwt->win_h_x1,
 3417|       |                           (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3418|       |                           -opj_dwt_alpha);
 3419|       |#endif
 3420|   121k|}
dwt.c:opj_v8dwt_decode_step1_sse:
 3236|   242k|{
 3237|   242k|    __m128* OPJ_RESTRICT vw = (__m128*) w;
 3238|   242k|    OPJ_UINT32 i = start;
 3239|       |    /* To be adapted if NB_ELTS_V8 changes */
 3240|   242k|    vw += 4 * start;
 3241|       |    /* Note: attempt at loop unrolling x2 doesn't help */
 3242|  40.0M|    for (; i < end; ++i, vw += 4) {
  ------------------
  |  Branch (3242:12): [True: 39.8M, False: 242k]
  ------------------
 3243|  39.8M|        vw[0] = _mm_mul_ps(vw[0], c);
 3244|  39.8M|        vw[1] = _mm_mul_ps(vw[1], c);
 3245|  39.8M|    }
 3246|   242k|}
dwt.c:opj_v8dwt_decode_step2_sse:
 3253|   484k|{
 3254|   484k|    __m128* OPJ_RESTRICT vl = (__m128*) l;
 3255|   484k|    __m128* OPJ_RESTRICT vw = (__m128*) w;
 3256|       |    /* To be adapted if NB_ELTS_V8 changes */
 3257|   484k|    OPJ_UINT32 i;
 3258|   484k|    OPJ_UINT32 imax = opj_uint_min(end, m);
 3259|   484k|    if (start == 0) {
  ------------------
  |  Branch (3259:9): [True: 484k, False: 0]
  ------------------
 3260|   484k|        if (imax >= 1) {
  ------------------
  |  Branch (3260:13): [True: 480k, False: 4.34k]
  ------------------
 3261|   480k|            vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(_mm_add_ps(vl[0], vw[0]), c));
 3262|   480k|            vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(_mm_add_ps(vl[1], vw[1]), c));
 3263|   480k|            vw += 4;
 3264|   480k|            start = 1;
 3265|   480k|        }
 3266|   484k|    } else {
 3267|      0|        vw += start * 4;
 3268|      0|    }
 3269|       |
 3270|   484k|    i = start;
 3271|       |    /* Note: attempt at loop unrolling x2 doesn't help */
 3272|  79.4M|    for (; i < imax; ++i) {
  ------------------
  |  Branch (3272:12): [True: 79.0M, False: 484k]
  ------------------
 3273|  79.0M|        vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(_mm_add_ps(vw[-4], vw[0]), c));
 3274|  79.0M|        vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(_mm_add_ps(vw[-3], vw[1]), c));
 3275|  79.0M|        vw += 4;
 3276|  79.0M|    }
 3277|   484k|    if (m < end) {
  ------------------
  |  Branch (3277:9): [True: 118k, False: 365k]
  ------------------
 3278|   118k|        assert(m + 1 == end);
 3279|   118k|        c = _mm_add_ps(c, c);
 3280|   118k|        vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(c, vw[-4]));
 3281|   118k|        vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(c, vw[-3]));
 3282|   118k|    }
 3283|   484k|}
dwt.c:opj_v8dwt_interleave_v:
 3191|  22.9k|{
 3192|  22.9k|    opj_v8_t* OPJ_RESTRICT bi = dwt->wavelet + dwt->cas;
 3193|  22.9k|    OPJ_UINT32 i;
 3194|       |
 3195|  1.42M|    for (i = dwt->win_l_x0; i < dwt->win_l_x1; ++i) {
  ------------------
  |  Branch (3195:29): [True: 1.39M, False: 22.9k]
  ------------------
 3196|  1.39M|        memcpy(&bi[i * 2], &a[i * (OPJ_SIZE_T)width],
 3197|  1.39M|               (OPJ_SIZE_T)nb_elts_read * sizeof(OPJ_FLOAT32));
 3198|  1.39M|    }
 3199|       |
 3200|  22.9k|    a += (OPJ_UINT32)dwt->sn * (OPJ_SIZE_T)width;
 3201|  22.9k|    bi = dwt->wavelet + 1 - dwt->cas;
 3202|       |
 3203|  1.41M|    for (i = dwt->win_h_x0; i < dwt->win_h_x1; ++i) {
  ------------------
  |  Branch (3203:29): [True: 1.39M, False: 22.9k]
  ------------------
 3204|  1.39M|        memcpy(&bi[i * 2], &a[i * (OPJ_SIZE_T)width],
 3205|  1.39M|               (OPJ_SIZE_T)nb_elts_read * sizeof(OPJ_FLOAT32));
 3206|  1.39M|    }
 3207|  22.9k|}
dwt.c:opj_dwt_decode_partial_97:
 3738|  1.81k|{
 3739|  1.81k|    opj_sparse_array_int32_t* sa;
 3740|  1.81k|    opj_v8dwt_t h;
 3741|  1.81k|    opj_v8dwt_t v;
 3742|  1.81k|    OPJ_UINT32 resno;
 3743|       |    /* This value matches the maximum left/right extension given in tables */
 3744|       |    /* F.2 and F.3 of the standard. Note: in opj_tcd_is_subband_area_of_interest() */
 3745|       |    /* we currently use 3. */
 3746|  1.81k|    const OPJ_UINT32 filter_width = 4U;
 3747|       |
 3748|  1.81k|    opj_tcd_resolution_t* tr = tilec->resolutions;
 3749|  1.81k|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 3750|       |
 3751|  1.81k|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 3752|  1.81k|                                 tr->x0);    /* width of the resolution level computed */
 3753|  1.81k|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 3754|  1.81k|                                 tr->y0);    /* height of the resolution level computed */
 3755|       |
 3756|  1.81k|    OPJ_SIZE_T l_data_size;
 3757|       |
 3758|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 3759|       |    /* with the tile coordinates */
 3760|  1.81k|    OPJ_UINT32 win_tcx0 = tilec->win_x0;
 3761|  1.81k|    OPJ_UINT32 win_tcy0 = tilec->win_y0;
 3762|  1.81k|    OPJ_UINT32 win_tcx1 = tilec->win_x1;
 3763|  1.81k|    OPJ_UINT32 win_tcy1 = tilec->win_y1;
 3764|       |
 3765|  1.81k|    if (tr_max->x0 == tr_max->x1 || tr_max->y0 == tr_max->y1) {
  ------------------
  |  Branch (3765:9): [True: 146, False: 1.67k]
  |  Branch (3765:37): [True: 473, False: 1.19k]
  ------------------
 3766|    619|        return OPJ_TRUE;
  ------------------
  |  |  117|    619|#define OPJ_TRUE 1
  ------------------
 3767|    619|    }
 3768|       |
 3769|  1.19k|    sa = opj_dwt_init_sparse_array(tilec, numres);
 3770|  1.19k|    if (sa == NULL) {
  ------------------
  |  Branch (3770:9): [True: 0, False: 1.19k]
  ------------------
 3771|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3772|      0|    }
 3773|       |
 3774|  1.19k|    if (numres == 1U) {
  ------------------
  |  Branch (3774:9): [True: 783, False: 414]
  ------------------
 3775|    783|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 3776|    783|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 3777|    783|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 3778|    783|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 3779|    783|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 3780|    783|                       tilec->data_win,
 3781|    783|                       1, tr_max->win_x1 - tr_max->win_x0,
 3782|    783|                       OPJ_TRUE);
  ------------------
  |  |  117|    783|#define OPJ_TRUE 1
  ------------------
 3783|    783|        assert(ret);
 3784|    783|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|    783|#define OPJ_UNUSED(x) (void)x
  ------------------
 3785|    783|        opj_sparse_array_int32_free(sa);
 3786|    783|        return OPJ_TRUE;
  ------------------
  |  |  117|    783|#define OPJ_TRUE 1
  ------------------
 3787|    783|    }
 3788|       |
 3789|    414|    l_data_size = opj_dwt_max_resolution(tr, numres);
 3790|       |    /* overflow check */
 3791|    414|    if (l_data_size > (SIZE_MAX / sizeof(opj_v8_t))) {
  ------------------
  |  Branch (3791:9): [True: 0, False: 414]
  ------------------
 3792|       |        /* FIXME event manager error callback */
 3793|      0|        opj_sparse_array_int32_free(sa);
 3794|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3795|      0|    }
 3796|    414|    h.wavelet = (opj_v8_t*) opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3797|    414|    if (!h.wavelet) {
  ------------------
  |  Branch (3797:9): [True: 0, False: 414]
  ------------------
 3798|       |        /* FIXME event manager error callback */
 3799|      0|        opj_sparse_array_int32_free(sa);
 3800|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3801|      0|    }
 3802|    414|    v.wavelet = h.wavelet;
 3803|       |
 3804|  3.26k|    for (resno = 1; resno < numres; resno ++) {
  ------------------
  |  Branch (3804:21): [True: 2.85k, False: 414]
  ------------------
 3805|  2.85k|        OPJ_UINT32 j;
 3806|       |        /* Window of interest subband-based coordinates */
 3807|  2.85k|        OPJ_UINT32 win_ll_x0, win_ll_y0, win_ll_x1, win_ll_y1;
 3808|  2.85k|        OPJ_UINT32 win_hl_x0, win_hl_x1;
 3809|  2.85k|        OPJ_UINT32 win_lh_y0, win_lh_y1;
 3810|       |        /* Window of interest tile-resolution-based coordinates */
 3811|  2.85k|        OPJ_UINT32 win_tr_x0, win_tr_x1, win_tr_y0, win_tr_y1;
 3812|       |        /* Tile-resolution subband-based coordinates */
 3813|  2.85k|        OPJ_UINT32 tr_ll_x0, tr_ll_y0, tr_hl_x0, tr_lh_y0;
 3814|       |
 3815|  2.85k|        ++tr;
 3816|       |
 3817|  2.85k|        h.sn = (OPJ_INT32)rw;
 3818|  2.85k|        v.sn = (OPJ_INT32)rh;
 3819|       |
 3820|  2.85k|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 3821|  2.85k|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 3822|       |
 3823|  2.85k|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 3824|  2.85k|        h.cas = tr->x0 % 2;
 3825|       |
 3826|  2.85k|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 3827|  2.85k|        v.cas = tr->y0 % 2;
 3828|       |
 3829|       |        /* Get the subband coordinates for the window of interest */
 3830|       |        /* LL band */
 3831|  2.85k|        opj_dwt_get_band_coordinates(tilec, resno, 0,
 3832|  2.85k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3833|  2.85k|                                     &win_ll_x0, &win_ll_y0,
 3834|  2.85k|                                     &win_ll_x1, &win_ll_y1);
 3835|       |
 3836|       |        /* HL band */
 3837|  2.85k|        opj_dwt_get_band_coordinates(tilec, resno, 1,
 3838|  2.85k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3839|  2.85k|                                     &win_hl_x0, NULL, &win_hl_x1, NULL);
 3840|       |
 3841|       |        /* LH band */
 3842|  2.85k|        opj_dwt_get_band_coordinates(tilec, resno, 2,
 3843|  2.85k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3844|  2.85k|                                     NULL, &win_lh_y0, NULL, &win_lh_y1);
 3845|       |
 3846|       |        /* Beware: band index for non-LL0 resolution are 0=HL, 1=LH and 2=HH */
 3847|  2.85k|        tr_ll_x0 = (OPJ_UINT32)tr->bands[1].x0;
 3848|  2.85k|        tr_ll_y0 = (OPJ_UINT32)tr->bands[0].y0;
 3849|  2.85k|        tr_hl_x0 = (OPJ_UINT32)tr->bands[0].x0;
 3850|  2.85k|        tr_lh_y0 = (OPJ_UINT32)tr->bands[1].y0;
 3851|       |
 3852|       |        /* Subtract the origin of the bands for this tile, to the subwindow */
 3853|       |        /* of interest band coordinates, so as to get them relative to the */
 3854|       |        /* tile */
 3855|  2.85k|        win_ll_x0 = opj_uint_subs(win_ll_x0, tr_ll_x0);
 3856|  2.85k|        win_ll_y0 = opj_uint_subs(win_ll_y0, tr_ll_y0);
 3857|  2.85k|        win_ll_x1 = opj_uint_subs(win_ll_x1, tr_ll_x0);
 3858|  2.85k|        win_ll_y1 = opj_uint_subs(win_ll_y1, tr_ll_y0);
 3859|  2.85k|        win_hl_x0 = opj_uint_subs(win_hl_x0, tr_hl_x0);
 3860|  2.85k|        win_hl_x1 = opj_uint_subs(win_hl_x1, tr_hl_x0);
 3861|  2.85k|        win_lh_y0 = opj_uint_subs(win_lh_y0, tr_lh_y0);
 3862|  2.85k|        win_lh_y1 = opj_uint_subs(win_lh_y1, tr_lh_y0);
 3863|       |
 3864|  2.85k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.sn, &win_ll_x0, &win_ll_x1);
 3865|  2.85k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.dn, &win_hl_x0, &win_hl_x1);
 3866|       |
 3867|  2.85k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.sn, &win_ll_y0, &win_ll_y1);
 3868|  2.85k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.dn, &win_lh_y0, &win_lh_y1);
 3869|       |
 3870|       |        /* Compute the tile-resolution-based coordinates for the window of interest */
 3871|  2.85k|        if (h.cas == 0) {
  ------------------
  |  Branch (3871:13): [True: 1.46k, False: 1.38k]
  ------------------
 3872|  1.46k|            win_tr_x0 = opj_uint_min(2 * win_ll_x0, 2 * win_hl_x0 + 1);
 3873|  1.46k|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_ll_x1, 2 * win_hl_x1 + 1), rw);
 3874|  1.46k|        } else {
 3875|  1.38k|            win_tr_x0 = opj_uint_min(2 * win_hl_x0, 2 * win_ll_x0 + 1);
 3876|  1.38k|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_hl_x1, 2 * win_ll_x1 + 1), rw);
 3877|  1.38k|        }
 3878|       |
 3879|  2.85k|        if (v.cas == 0) {
  ------------------
  |  Branch (3879:13): [True: 971, False: 1.88k]
  ------------------
 3880|    971|            win_tr_y0 = opj_uint_min(2 * win_ll_y0, 2 * win_lh_y0 + 1);
 3881|    971|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_ll_y1, 2 * win_lh_y1 + 1), rh);
 3882|  1.88k|        } else {
 3883|  1.88k|            win_tr_y0 = opj_uint_min(2 * win_lh_y0, 2 * win_ll_y0 + 1);
 3884|  1.88k|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_lh_y1, 2 * win_ll_y1 + 1), rh);
 3885|  1.88k|        }
 3886|       |
 3887|  2.85k|        h.win_l_x0 = win_ll_x0;
 3888|  2.85k|        h.win_l_x1 = win_ll_x1;
 3889|  2.85k|        h.win_h_x0 = win_hl_x0;
 3890|  2.85k|        h.win_h_x1 = win_hl_x1;
 3891|  18.2M|        for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   93|  18.2M|#define NB_ELTS_V8  8
  ------------------
                      for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   93|  18.2M|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3891:21): [True: 18.2M, False: 2.85k]
  ------------------
 3892|  18.2M|            if ((j + (NB_ELTS_V8 - 1) >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  |   93|  18.2M|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3892:18): [True: 18.2M, False: 0]
  |  Branch (3892:55): [True: 16.8k, False: 18.1M]
  ------------------
 3893|  18.2M|                    (j + (NB_ELTS_V8 - 1) >= win_lh_y0 + (OPJ_UINT32)v.sn &&
  ------------------
  |  |   93|  18.1M|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3893:22): [True: 9.10M, False: 9.08M]
  ------------------
 3894|  18.1M|                     j < win_lh_y1 + (OPJ_UINT32)v.sn)) {
  ------------------
  |  Branch (3894:22): [True: 16.8k, False: 9.08M]
  ------------------
 3895|  33.7k|                opj_v8dwt_interleave_partial_h(&h, sa, j, opj_uint_min(NB_ELTS_V8, rh - j));
  ------------------
  |  |   93|  33.7k|#define NB_ELTS_V8  8
  ------------------
 3896|  33.7k|                opj_v8dwt_decode(&h);
 3897|  33.7k|                if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3897:21): [True: 0, False: 33.7k]
  ------------------
 3898|  33.7k|                                                  win_tr_x0, j,
 3899|  33.7k|                                                  win_tr_x1, j + NB_ELTS_V8,
  ------------------
  |  |   93|  33.7k|#define NB_ELTS_V8  8
  ------------------
 3900|  33.7k|                                                  (OPJ_INT32*)&h.wavelet[win_tr_x0].f[0],
 3901|  33.7k|                                                  NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |   93|  33.7k|#define NB_ELTS_V8  8
  ------------------
                                                                NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |  117|  33.7k|#define OPJ_TRUE 1
  ------------------
 3902|       |                    /* FIXME event manager error callback */
 3903|      0|                    opj_sparse_array_int32_free(sa);
 3904|      0|                    opj_aligned_free(h.wavelet);
 3905|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3906|      0|                }
 3907|  33.7k|            }
 3908|  18.2M|        }
 3909|       |
 3910|  2.85k|        if (j < rh &&
  ------------------
  |  Branch (3910:13): [True: 1.61k, False: 1.23k]
  ------------------
 3911|  2.85k|                ((j + (NB_ELTS_V8 - 1) >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  |   93|  1.61k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3911:19): [True: 1.61k, False: 0]
  |  Branch (3911:56): [True: 522, False: 1.09k]
  ------------------
 3912|  1.61k|                 (j + (NB_ELTS_V8 - 1) >= win_lh_y0 + (OPJ_UINT32)v.sn &&
  ------------------
  |  |   93|  1.09k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3912:19): [True: 1.09k, False: 0]
  ------------------
 3913|  1.09k|                  j < win_lh_y1 + (OPJ_UINT32)v.sn))) {
  ------------------
  |  Branch (3913:19): [True: 286, False: 810]
  ------------------
 3914|    808|            opj_v8dwt_interleave_partial_h(&h, sa, j, rh - j);
 3915|    808|            opj_v8dwt_decode(&h);
 3916|    808|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3916:17): [True: 0, False: 808]
  ------------------
 3917|    808|                                              win_tr_x0, j,
 3918|    808|                                              win_tr_x1, rh,
 3919|    808|                                              (OPJ_INT32*)&h.wavelet[win_tr_x0].f[0],
 3920|    808|                                              NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |   93|    808|#define NB_ELTS_V8  8
  ------------------
                                                            NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |  117|    808|#define OPJ_TRUE 1
  ------------------
 3921|       |                /* FIXME event manager error callback */
 3922|      0|                opj_sparse_array_int32_free(sa);
 3923|      0|                opj_aligned_free(h.wavelet);
 3924|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3925|      0|            }
 3926|    808|        }
 3927|       |
 3928|  2.85k|        v.win_l_x0 = win_ll_y0;
 3929|  2.85k|        v.win_l_x1 = win_ll_y1;
 3930|  2.85k|        v.win_h_x0 = win_lh_y0;
 3931|  2.85k|        v.win_h_x1 = win_lh_y1;
 3932|  48.6k|        for (j = win_tr_x0; j < win_tr_x1; j += NB_ELTS_V8) {
  ------------------
  |  |   93|  45.8k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3932:29): [True: 45.8k, False: 2.85k]
  ------------------
 3933|  45.8k|            OPJ_UINT32 nb_elts = opj_uint_min(NB_ELTS_V8, win_tr_x1 - j);
  ------------------
  |  |   93|  45.8k|#define NB_ELTS_V8  8
  ------------------
 3934|       |
 3935|  45.8k|            opj_v8dwt_interleave_partial_v(&v, sa, j, nb_elts);
 3936|  45.8k|            opj_v8dwt_decode(&v);
 3937|       |
 3938|  45.8k|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3938:17): [True: 0, False: 45.8k]
  ------------------
 3939|  45.8k|                                              j, win_tr_y0,
 3940|  45.8k|                                              j + nb_elts, win_tr_y1,
 3941|  45.8k|                                              (OPJ_INT32*)&h.wavelet[win_tr_y0].f[0],
 3942|  45.8k|                                              1, NB_ELTS_V8, OPJ_TRUE)) {
  ------------------
  |  |   93|  45.8k|#define NB_ELTS_V8  8
  ------------------
                                                            1, NB_ELTS_V8, OPJ_TRUE)) {
  ------------------
  |  |  117|  45.8k|#define OPJ_TRUE 1
  ------------------
 3943|       |                /* FIXME event manager error callback */
 3944|      0|                opj_sparse_array_int32_free(sa);
 3945|      0|                opj_aligned_free(h.wavelet);
 3946|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3947|      0|            }
 3948|  45.8k|        }
 3949|  2.85k|    }
 3950|       |
 3951|    414|    {
 3952|    414|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 3953|    414|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 3954|    414|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 3955|    414|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 3956|    414|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 3957|    414|                       tilec->data_win,
 3958|    414|                       1, tr_max->win_x1 - tr_max->win_x0,
 3959|    414|                       OPJ_TRUE);
  ------------------
  |  |  117|    414|#define OPJ_TRUE 1
  ------------------
 3960|    414|        assert(ret);
 3961|    414|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|    414|#define OPJ_UNUSED(x) (void)x
  ------------------
 3962|    414|    }
 3963|    414|    opj_sparse_array_int32_free(sa);
 3964|       |
 3965|    414|    opj_aligned_free(h.wavelet);
 3966|    414|    return OPJ_TRUE;
  ------------------
  |  |  117|    414|#define OPJ_TRUE 1
  ------------------
 3967|    414|}
dwt.c:opj_v8dwt_interleave_partial_h:
 3165|  34.5k|{
 3166|  34.5k|    OPJ_UINT32 i;
 3167|   306k|    for (i = 0; i < remaining_height; i++) {
  ------------------
  |  Branch (3167:17): [True: 272k, False: 34.5k]
  ------------------
 3168|   272k|        OPJ_BOOL ret;
 3169|   272k|        ret = opj_sparse_array_int32_read(sa,
 3170|   272k|                                          dwt->win_l_x0, sa_line + i,
 3171|   272k|                                          dwt->win_l_x1, sa_line + i + 1,
 3172|       |                                          /* Nasty cast from float* to int32* */
 3173|   272k|                                          (OPJ_INT32*)(dwt->wavelet + dwt->cas + 2 * dwt->win_l_x0) + i,
 3174|   272k|                                          2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |   93|   272k|#define NB_ELTS_V8  8
  ------------------
                                                        2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |  117|   272k|#define OPJ_TRUE 1
  ------------------
 3175|   272k|        assert(ret);
 3176|   272k|        ret = opj_sparse_array_int32_read(sa,
 3177|   272k|                                          (OPJ_UINT32)dwt->sn + dwt->win_h_x0, sa_line + i,
 3178|   272k|                                          (OPJ_UINT32)dwt->sn + dwt->win_h_x1, sa_line + i + 1,
 3179|       |                                          /* Nasty cast from float* to int32* */
 3180|   272k|                                          (OPJ_INT32*)(dwt->wavelet + 1 - dwt->cas + 2 * dwt->win_h_x0) + i,
 3181|   272k|                                          2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |   93|   272k|#define NB_ELTS_V8  8
  ------------------
                                                        2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |  117|   272k|#define OPJ_TRUE 1
  ------------------
 3182|   272k|        assert(ret);
 3183|   272k|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|   272k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3184|   272k|    }
 3185|  34.5k|}
dwt.c:opj_v8dwt_interleave_partial_v:
 3213|  45.8k|{
 3214|  45.8k|    OPJ_BOOL ret;
 3215|  45.8k|    ret = opj_sparse_array_int32_read(sa,
 3216|  45.8k|                                      sa_col, dwt->win_l_x0,
 3217|  45.8k|                                      sa_col + nb_elts_read, dwt->win_l_x1,
 3218|  45.8k|                                      (OPJ_INT32*)(dwt->wavelet + dwt->cas + 2 * dwt->win_l_x0),
 3219|  45.8k|                                      1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |   93|  45.8k|#define NB_ELTS_V8  8
  ------------------
                                                    1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |  117|  45.8k|#define OPJ_TRUE 1
  ------------------
 3220|  45.8k|    assert(ret);
 3221|  45.8k|    ret = opj_sparse_array_int32_read(sa,
 3222|  45.8k|                                      sa_col, (OPJ_UINT32)dwt->sn + dwt->win_h_x0,
 3223|  45.8k|                                      sa_col + nb_elts_read, (OPJ_UINT32)dwt->sn + dwt->win_h_x1,
 3224|  45.8k|                                      (OPJ_INT32*)(dwt->wavelet + 1 - dwt->cas + 2 * dwt->win_h_x0),
 3225|  45.8k|                                      1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |   93|  45.8k|#define NB_ELTS_V8  8
  ------------------
                                                    1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |  117|  45.8k|#define OPJ_TRUE 1
  ------------------
 3226|  45.8k|    assert(ret);
 3227|  45.8k|    OPJ_UNUSED(ret);
  ------------------
  |  |  221|  45.8k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3228|  45.8k|}

opj_event_msg:
   93|  1.19M|{
   94|  1.19M|#define OPJ_MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
   95|  1.19M|    opj_msg_callback msg_handler = 00;
   96|  1.19M|    void * l_data = 00;
   97|       |
   98|  1.19M|    if (p_event_mgr != 00) {
  ------------------
  |  Branch (98:9): [True: 1.19M, False: 0]
  ------------------
   99|  1.19M|        switch (event_type) {
  100|  21.4k|        case EVT_ERROR:
  ------------------
  |  |   66|  21.4k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  |  Branch (100:9): [True: 21.4k, False: 1.17M]
  ------------------
  101|  21.4k|            msg_handler = p_event_mgr->error_handler;
  102|  21.4k|            l_data = p_event_mgr->m_error_data;
  103|  21.4k|            break;
  104|  1.13M|        case EVT_WARNING:
  ------------------
  |  |   67|  1.13M|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
  |  Branch (104:9): [True: 1.13M, False: 64.3k]
  ------------------
  105|  1.13M|            msg_handler = p_event_mgr->warning_handler;
  106|  1.13M|            l_data = p_event_mgr->m_warning_data;
  107|  1.13M|            break;
  108|  42.9k|        case EVT_INFO:
  ------------------
  |  |   68|  42.9k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  |  Branch (108:9): [True: 42.9k, False: 1.15M]
  ------------------
  109|  42.9k|            msg_handler = p_event_mgr->info_handler;
  110|  42.9k|            l_data = p_event_mgr->m_info_data;
  111|  42.9k|            break;
  112|      0|        default:
  ------------------
  |  Branch (112:9): [True: 0, False: 1.19M]
  ------------------
  113|      0|            break;
  114|  1.19M|        }
  115|  1.19M|        if (msg_handler == 00) {
  ------------------
  |  Branch (115:13): [True: 0, False: 1.19M]
  ------------------
  116|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  117|      0|        }
  118|  1.19M|    } else {
  119|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  120|      0|    }
  121|       |
  122|  1.19M|    if ((fmt != 00) && (p_event_mgr != 00)) {
  ------------------
  |  Branch (122:9): [True: 1.19M, False: 0]
  |  Branch (122:24): [True: 1.19M, False: 0]
  ------------------
  123|  1.19M|        va_list arg;
  124|  1.19M|        char message[OPJ_MSG_SIZE];
  125|  1.19M|        memset(message, 0, OPJ_MSG_SIZE);
  ------------------
  |  |   94|  1.19M|#define OPJ_MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
  ------------------
  126|       |        /* initialize the optional parameter list */
  127|  1.19M|        va_start(arg, fmt);
  128|       |        /* parse the format string and put the result in 'message' */
  129|  1.19M|        vsnprintf(message, OPJ_MSG_SIZE, fmt, arg);
  ------------------
  |  |   94|  1.19M|#define OPJ_MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
  ------------------
  130|       |        /* force zero termination for Windows _vsnprintf() of old MSVC */
  131|  1.19M|        message[OPJ_MSG_SIZE - 1] = '\0';
  ------------------
  |  |   94|  1.19M|#define OPJ_MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
  ------------------
  132|       |        /* deinitialize the optional parameter list */
  133|  1.19M|        va_end(arg);
  134|       |
  135|       |        /* output the message to the user program */
  136|  1.19M|        msg_handler(message, l_data);
  137|  1.19M|    }
  138|       |
  139|  1.19M|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.19M|#define OPJ_TRUE 1
  ------------------
  140|  1.19M|}
opj_set_default_event_handler:
  143|  8.85k|{
  144|  8.85k|    p_manager->m_error_data = 00;
  145|  8.85k|    p_manager->m_warning_data = 00;
  146|  8.85k|    p_manager->m_info_data = 00;
  147|  8.85k|    p_manager->error_handler = opj_default_callback;
  148|  8.85k|    p_manager->info_handler = opj_default_callback;
  149|  8.85k|    p_manager->warning_handler = opj_default_callback;
  150|  8.85k|}

opj_procedure_list_create:
   40|  17.7k|{
   41|       |    /* memory allocation */
   42|  17.7k|    opj_procedure_list_t * l_validation = (opj_procedure_list_t *) opj_calloc(1,
   43|  17.7k|                                          sizeof(opj_procedure_list_t));
   44|  17.7k|    if (! l_validation) {
  ------------------
  |  Branch (44:9): [True: 0, False: 17.7k]
  ------------------
   45|      0|        return 00;
   46|      0|    }
   47|       |    /* initialization */
   48|  17.7k|    l_validation->m_nb_max_procedures = OPJ_VALIDATION_SIZE;
  ------------------
  |  |   37|  17.7k|#define OPJ_VALIDATION_SIZE 10
  ------------------
   49|  17.7k|    l_validation->m_procedures = (opj_procedure*)opj_calloc(OPJ_VALIDATION_SIZE,
  ------------------
  |  |   37|  17.7k|#define OPJ_VALIDATION_SIZE 10
  ------------------
   50|  17.7k|                                 sizeof(opj_procedure));
   51|  17.7k|    if (! l_validation->m_procedures) {
  ------------------
  |  Branch (51:9): [True: 0, False: 17.7k]
  ------------------
   52|      0|        opj_free(l_validation);
   53|      0|        return 00;
   54|      0|    }
   55|  17.7k|    return l_validation;
   56|  17.7k|}
opj_procedure_list_destroy:
   59|  17.7k|{
   60|  17.7k|    if (! p_list) {
  ------------------
  |  Branch (60:9): [True: 0, False: 17.7k]
  ------------------
   61|      0|        return;
   62|      0|    }
   63|       |    /* initialization */
   64|  17.7k|    if (p_list->m_procedures) {
  ------------------
  |  Branch (64:9): [True: 17.7k, False: 0]
  ------------------
   65|  17.7k|        opj_free(p_list->m_procedures);
   66|  17.7k|    }
   67|  17.7k|    opj_free(p_list);
   68|  17.7k|}
opj_procedure_list_add_procedure:
   72|  42.8k|{
   73|       |
   74|  42.8k|    assert(p_manager != NULL);
   75|       |
   76|  42.8k|    if (p_validation_list->m_nb_max_procedures ==
  ------------------
  |  Branch (76:9): [True: 0, False: 42.8k]
  ------------------
   77|  42.8k|            p_validation_list->m_nb_procedures) {
   78|      0|        opj_procedure * new_procedures;
   79|       |
   80|      0|        p_validation_list->m_nb_max_procedures += OPJ_VALIDATION_SIZE;
  ------------------
  |  |   37|      0|#define OPJ_VALIDATION_SIZE 10
  ------------------
   81|      0|        new_procedures = (opj_procedure*)opj_realloc(
   82|      0|                             p_validation_list->m_procedures,
   83|      0|                             p_validation_list->m_nb_max_procedures * sizeof(opj_procedure));
   84|      0|        if (! new_procedures) {
  ------------------
  |  Branch (84:13): [True: 0, False: 0]
  ------------------
   85|      0|            opj_free(p_validation_list->m_procedures);
   86|      0|            p_validation_list->m_nb_max_procedures = 0;
   87|      0|            p_validation_list->m_nb_procedures = 0;
   88|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
   89|      0|                          "Not enough memory to add a new validation procedure\n");
   90|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
   91|      0|        } else {
   92|      0|            p_validation_list->m_procedures = new_procedures;
   93|      0|        }
   94|      0|    }
   95|  42.8k|    p_validation_list->m_procedures[p_validation_list->m_nb_procedures] =
   96|  42.8k|        p_procedure;
   97|  42.8k|    ++p_validation_list->m_nb_procedures;
   98|       |
   99|  42.8k|    return OPJ_TRUE;
  ------------------
  |  |  117|  42.8k|#define OPJ_TRUE 1
  ------------------
  100|  42.8k|}
opj_procedure_list_get_nb_procedures:
  104|  25.1k|{
  105|  25.1k|    return p_validation_list->m_nb_procedures;
  106|  25.1k|}
opj_procedure_list_get_first_procedure:
  110|  25.1k|{
  111|  25.1k|    return p_validation_list->m_procedures;
  112|  25.1k|}
opj_procedure_list_clear:
  115|  25.1k|{
  116|  25.1k|    p_validation_list->m_nb_procedures = 0;
  117|  25.1k|}

opj_t1_ht_decode_cblk:
 1140|  60.2k|{
 1141|  60.2k|    OPJ_BYTE* cblkdata = NULL;
 1142|  60.2k|    OPJ_UINT8* coded_data;
 1143|  60.2k|    OPJ_UINT32* decoded_data;
 1144|  60.2k|    OPJ_UINT32 zero_bplanes;
 1145|  60.2k|    OPJ_UINT32 num_passes;
 1146|  60.2k|    OPJ_UINT32 lengths1;
 1147|  60.2k|    OPJ_UINT32 lengths2;
 1148|  60.2k|    OPJ_INT32 width;
 1149|  60.2k|    OPJ_INT32 height;
 1150|  60.2k|    OPJ_INT32 stride;
 1151|  60.2k|    OPJ_UINT32 *pflags, *sigma1, *sigma2, *mbr1, *mbr2, *sip, sip_shift;
 1152|  60.2k|    OPJ_UINT32 p;
 1153|  60.2k|    OPJ_UINT32 zero_bplanes_p1;
 1154|  60.2k|    int lcup, scup;
 1155|  60.2k|    dec_mel_t mel;
 1156|  60.2k|    rev_struct_t vlc;
 1157|  60.2k|    frwd_struct_t magsgn;
 1158|  60.2k|    frwd_struct_t sigprop;
 1159|  60.2k|    rev_struct_t magref;
 1160|  60.2k|    OPJ_UINT8 *lsp, *line_state;
 1161|  60.2k|    int run;
 1162|  60.2k|    OPJ_UINT32 vlc_val;              // fetched data from VLC bitstream
 1163|  60.2k|    OPJ_UINT32 qinf[2];
 1164|  60.2k|    OPJ_UINT32 c_q;
 1165|  60.2k|    OPJ_UINT32* sp;
 1166|  60.2k|    OPJ_INT32 x, y; // loop indices
 1167|  60.2k|    OPJ_BOOL stripe_causal = (cblksty & J2K_CCP_CBLKSTY_VSC) != 0;
  ------------------
  |  |   61|  60.2k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
 1168|  60.2k|    OPJ_UINT32 cblk_len = 0;
 1169|       |
 1170|  60.2k|    (void)(orient);      // stops unused parameter message
 1171|  60.2k|    (void)(check_pterm); // stops unused parameter message
 1172|       |
 1173|       |    // We ignor orient, because the same decoder is used for all subbands
 1174|       |    // We also ignore check_pterm, because I am not sure how it applies
 1175|  60.2k|    if (roishift != 0) {
  ------------------
  |  Branch (1175:9): [True: 0, False: 60.2k]
  ------------------
 1176|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1176:13): [True: 0, False: 0]
  ------------------
 1177|      0|            opj_mutex_lock(p_manager_mutex);
 1178|      0|        }
 1179|      0|        opj_event_msg(p_manager, EVT_ERROR, "We do not support ROI in decoding "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1180|      0|                      "HT codeblocks\n");
 1181|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1181:13): [True: 0, False: 0]
  ------------------
 1182|      0|            opj_mutex_unlock(p_manager_mutex);
 1183|      0|        }
 1184|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1185|      0|    }
 1186|       |
 1187|  60.2k|    if (!opj_t1_allocate_buffers(
  ------------------
  |  Branch (1187:9): [True: 0, False: 60.2k]
  ------------------
 1188|  60.2k|                t1,
 1189|  60.2k|                (OPJ_UINT32)(cblk->x1 - cblk->x0),
 1190|  60.2k|                (OPJ_UINT32)(cblk->y1 - cblk->y0))) {
 1191|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1192|      0|    }
 1193|       |
 1194|  60.2k|    if (cblk->Mb == 0) {
  ------------------
  |  Branch (1194:9): [True: 60.0k, False: 161]
  ------------------
 1195|  60.0k|        return OPJ_TRUE;
  ------------------
  |  |  117|  60.0k|#define OPJ_TRUE 1
  ------------------
 1196|  60.0k|    }
 1197|       |
 1198|       |    /* numbps = Mb + 1 - zero_bplanes, Mb = Kmax, zero_bplanes = missing_msbs */
 1199|    161|    zero_bplanes = (cblk->Mb + 1) - cblk->numbps;
 1200|       |
 1201|       |    /* Compute whole codeblock length from chunk lengths */
 1202|    161|    cblk_len = 0;
 1203|    161|    {
 1204|    161|        OPJ_UINT32 i;
 1205|    485|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (1205:21): [True: 324, False: 161]
  ------------------
 1206|    324|            cblk_len += cblk->chunks[i].len;
 1207|    324|        }
 1208|    161|    }
 1209|       |
 1210|    161|    if (cblk->numchunks > 1 || t1->mustuse_cblkdatabuffer) {
  ------------------
  |  Branch (1210:9): [True: 119, False: 42]
  |  Branch (1210:32): [True: 0, False: 42]
  ------------------
 1211|    119|        OPJ_UINT32 i;
 1212|       |
 1213|       |        /* Allocate temporary memory if needed */
 1214|    119|        if (cblk_len > t1->cblkdatabuffersize) {
  ------------------
  |  Branch (1214:13): [True: 69, False: 50]
  ------------------
 1215|     69|            cblkdata = (OPJ_BYTE*)opj_realloc(
 1216|     69|                           t1->cblkdatabuffer, cblk_len);
 1217|     69|            if (cblkdata == NULL) {
  ------------------
  |  Branch (1217:17): [True: 0, False: 69]
  ------------------
 1218|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1219|      0|            }
 1220|     69|            t1->cblkdatabuffer = cblkdata;
 1221|     69|            t1->cblkdatabuffersize = cblk_len;
 1222|     69|        }
 1223|       |
 1224|       |        /* Concatenate all chunks */
 1225|    119|        cblkdata = t1->cblkdatabuffer;
 1226|    119|        if (cblkdata == NULL) {
  ------------------
  |  Branch (1226:13): [True: 1, False: 118]
  ------------------
 1227|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1228|      1|        }
 1229|    118|        cblk_len = 0;
 1230|    398|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (1230:21): [True: 280, False: 118]
  ------------------
 1231|    280|            memcpy(cblkdata + cblk_len, cblk->chunks[i].data, cblk->chunks[i].len);
 1232|    280|            cblk_len += cblk->chunks[i].len;
 1233|    280|        }
 1234|    118|    } else if (cblk->numchunks == 1) {
  ------------------
  |  Branch (1234:16): [True: 42, False: 0]
  ------------------
 1235|     42|        cblkdata = cblk->chunks[0].data;
 1236|     42|    } else {
 1237|       |        /* Not sure if that can happen in practice, but avoid Coverity to */
 1238|       |        /* think we will dereference a null cblkdta pointer */
 1239|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1240|      0|    }
 1241|       |
 1242|       |    // OPJ_BYTE* coded_data is a pointer to bitstream
 1243|    160|    coded_data = cblkdata;
 1244|       |    // OPJ_UINT32* decoded_data is a pointer to decoded codeblock data buf.
 1245|    160|    decoded_data = (OPJ_UINT32*)t1->data;
 1246|       |    // OPJ_UINT32 num_passes is the number of passes: 1 if CUP only, 2 for
 1247|       |    // CUP+SPP, and 3 for CUP+SPP+MRP
 1248|    160|    num_passes = cblk->numsegs > 0 ? cblk->segs[0].real_num_passes : 0;
  ------------------
  |  Branch (1248:18): [True: 160, False: 0]
  ------------------
 1249|    160|    num_passes += cblk->numsegs > 1 ? cblk->segs[1].real_num_passes : 0;
  ------------------
  |  Branch (1249:19): [True: 118, False: 42]
  ------------------
 1250|       |    // OPJ_UINT32 lengths1 is the length of cleanup pass
 1251|    160|    lengths1 = num_passes > 0 ? cblk->segs[0].len : 0;
  ------------------
  |  Branch (1251:16): [True: 160, False: 0]
  ------------------
 1252|       |    // OPJ_UINT32 lengths2 is the length of refinement passes (either SPP only or SPP+MRP)
 1253|    160|    lengths2 = num_passes > 1 ? cblk->segs[1].len : 0;
  ------------------
  |  Branch (1253:16): [True: 118, False: 42]
  ------------------
 1254|       |    // OPJ_INT32 width is the decoded codeblock width
 1255|    160|    width = cblk->x1 - cblk->x0;
 1256|       |    // OPJ_INT32 height is the decoded codeblock height
 1257|    160|    height = cblk->y1 - cblk->y0;
 1258|       |    // OPJ_INT32 stride is the decoded codeblock buffer stride
 1259|    160|    stride = width;
 1260|       |
 1261|       |    /*  sigma1 and sigma2 contains significant (i.e., non-zero) pixel
 1262|       |     *  locations.  The buffers are used interchangeably, because we need
 1263|       |     *  more than 4 rows of significance information at a given time.
 1264|       |     *  Each 32 bits contain significance information for 4 rows of 8
 1265|       |     *  columns each.  If we denote 32 bits by 0xaaaaaaaa, the each "a" is
 1266|       |     *  called a nibble and has significance information for 4 rows.
 1267|       |     *  The least significant nibble has information for the first column,
 1268|       |     *  and so on. The nibble's LSB is for the first row, and so on.
 1269|       |     *  Since, at most, we can have 1024 columns in a quad, we need 128
 1270|       |     *  entries; we added 1 for convenience when propagation of signifcance
 1271|       |     *  goes outside the structure
 1272|       |     *  To work in OpenJPEG these buffers has been expanded to 132.
 1273|       |     */
 1274|       |    // OPJ_UINT32 *pflags, *sigma1, *sigma2, *mbr1, *mbr2, *sip, sip_shift;
 1275|    160|    pflags = (OPJ_UINT32 *)t1->flags;
 1276|    160|    sigma1 = pflags;
 1277|    160|    sigma2 = sigma1 + 132;
 1278|       |    // mbr arrangement is similar to sigma; mbr contains locations
 1279|       |    // that become significant during significance propagation pass
 1280|    160|    mbr1 = sigma2 + 132;
 1281|    160|    mbr2 = mbr1 + 132;
 1282|       |    //a pointer to sigma
 1283|    160|    sip = sigma1;  //pointers to arrays to be used interchangeably
 1284|    160|    sip_shift = 0; //the amount of shift needed for sigma
 1285|       |
 1286|    160|    if (num_passes > 1 && lengths2 == 0) {
  ------------------
  |  Branch (1286:9): [True: 118, False: 42]
  |  Branch (1286:27): [True: 7, False: 111]
  ------------------
 1287|      7|        if (p_manager_mutex) {
  ------------------
  |  Branch (1287:13): [True: 7, False: 0]
  ------------------
 1288|      7|            opj_mutex_lock(p_manager_mutex);
 1289|      7|        }
 1290|      7|        opj_event_msg(p_manager, EVT_WARNING, "A malformed codeblock that has "
  ------------------
  |  |   67|      7|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1291|      7|                      "more than one coding pass, but zero length for "
 1292|      7|                      "2nd and potentially the 3rd pass in an HT codeblock.\n");
 1293|      7|        if (p_manager_mutex) {
  ------------------
  |  Branch (1293:13): [True: 7, False: 0]
  ------------------
 1294|      7|            opj_mutex_unlock(p_manager_mutex);
 1295|      7|        }
 1296|      7|        num_passes = 1;
 1297|      7|    }
 1298|    160|    if (num_passes > 3) {
  ------------------
  |  Branch (1298:9): [True: 1, False: 159]
  ------------------
 1299|      1|        if (p_manager_mutex) {
  ------------------
  |  Branch (1299:13): [True: 1, False: 0]
  ------------------
 1300|      1|            opj_mutex_lock(p_manager_mutex);
 1301|      1|        }
 1302|      1|        opj_event_msg(p_manager, EVT_ERROR, "We do not support more than 3 "
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1303|      1|                      "coding passes in an HT codeblock; This codeblocks has "
 1304|      1|                      "%d passes.\n", num_passes);
 1305|      1|        if (p_manager_mutex) {
  ------------------
  |  Branch (1305:13): [True: 1, False: 0]
  ------------------
 1306|      1|            opj_mutex_unlock(p_manager_mutex);
 1307|      1|        }
 1308|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1309|      1|    }
 1310|       |
 1311|    159|    if (cblk->Mb > 30) {
  ------------------
  |  Branch (1311:9): [True: 24, False: 135]
  ------------------
 1312|       |        /* This check is better moved to opj_t2_read_packet_header() in t2.c
 1313|       |           We do not have enough precision to decode any passes
 1314|       |           The design of openjpeg assumes that the bits of a 32-bit integer are
 1315|       |           assigned as follows:
 1316|       |           bit 31 is for sign
 1317|       |           bits 30-1 are for magnitude
 1318|       |           bit 0 is for the center of the quantization bin
 1319|       |           Therefore we can only do values of cblk->Mb <= 30
 1320|       |         */
 1321|     24|        if (p_manager_mutex) {
  ------------------
  |  Branch (1321:13): [True: 24, False: 0]
  ------------------
 1322|     24|            opj_mutex_lock(p_manager_mutex);
 1323|     24|        }
 1324|     24|        opj_event_msg(p_manager, EVT_ERROR, "32 bits are not enough to "
  ------------------
  |  |   66|     24|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1325|     24|                      "decode this codeblock, since the number of "
 1326|     24|                      "bitplane, %d, is larger than 30.\n", cblk->Mb);
 1327|     24|        if (p_manager_mutex) {
  ------------------
  |  Branch (1327:13): [True: 24, False: 0]
  ------------------
 1328|     24|            opj_mutex_unlock(p_manager_mutex);
 1329|     24|        }
 1330|     24|        return OPJ_FALSE;
  ------------------
  |  |  118|     24|#define OPJ_FALSE 0
  ------------------
 1331|     24|    }
 1332|    135|    if (zero_bplanes > cblk->Mb) {
  ------------------
  |  Branch (1332:9): [True: 0, False: 135]
  ------------------
 1333|       |        /* This check is better moved to opj_t2_read_packet_header() in t2.c,
 1334|       |           in the line "l_cblk->numbps = (OPJ_UINT32)l_band->numbps + 1 - i;"
 1335|       |           where i is the zero bitplanes, and should be no larger than cblk->Mb
 1336|       |           We cannot have more zero bitplanes than there are planes. */
 1337|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1337:13): [True: 0, False: 0]
  ------------------
 1338|      0|            opj_mutex_lock(p_manager_mutex);
 1339|      0|        }
 1340|      0|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1341|      0|                      "Decoding this codeblock is stopped. There are "
 1342|      0|                      "%d zero bitplanes in %d bitplanes.\n",
 1343|      0|                      zero_bplanes, cblk->Mb);
 1344|       |
 1345|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1345:13): [True: 0, False: 0]
  ------------------
 1346|      0|            opj_mutex_unlock(p_manager_mutex);
 1347|      0|        }
 1348|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1349|    135|    } else if (zero_bplanes == cblk->Mb && num_passes > 1) {
  ------------------
  |  Branch (1349:16): [True: 2, False: 133]
  |  Branch (1349:44): [True: 0, False: 2]
  ------------------
 1350|       |        /* When the number of zero bitplanes is equal to the number of bitplanes,
 1351|       |           only the cleanup pass makes sense*/
 1352|      0|        if (only_cleanup_pass_is_decoded == OPJ_FALSE) {
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  |  Branch (1352:13): [True: 0, False: 0]
  ------------------
 1353|      0|            if (p_manager_mutex) {
  ------------------
  |  Branch (1353:17): [True: 0, False: 0]
  ------------------
 1354|      0|                opj_mutex_lock(p_manager_mutex);
 1355|      0|            }
 1356|       |            /* We have a second check to prevent the possibility of an overrun condition,
 1357|       |               in the very unlikely event of a second thread discovering that
 1358|       |               only_cleanup_pass_is_decoded is false before the first thread changing
 1359|       |               the condition. */
 1360|      0|            if (only_cleanup_pass_is_decoded == OPJ_FALSE) {
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  |  Branch (1360:17): [True: 0, False: 0]
  ------------------
 1361|      0|                only_cleanup_pass_is_decoded = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1362|      0|                opj_event_msg(p_manager, EVT_WARNING, "Malformed HT codeblock. "
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1363|      0|                              "When the number of zero planes bitplanes is "
 1364|      0|                              "equal to the number of bitplanes, only the cleanup "
 1365|      0|                              "pass makes sense, but we have %d passes in this "
 1366|      0|                              "codeblock. Therefore, only the cleanup pass will be "
 1367|      0|                              "decoded. This message will not be displayed again.\n",
 1368|      0|                              num_passes);
 1369|      0|            }
 1370|      0|            if (p_manager_mutex) {
  ------------------
  |  Branch (1370:17): [True: 0, False: 0]
  ------------------
 1371|      0|                opj_mutex_unlock(p_manager_mutex);
 1372|      0|            }
 1373|      0|        }
 1374|      0|        num_passes = 1;
 1375|      0|    }
 1376|       |
 1377|       |    /* OPJ_UINT32 */
 1378|    135|    p = cblk->numbps;
 1379|       |
 1380|       |    // OPJ_UINT32 zero planes plus 1
 1381|    135|    zero_bplanes_p1 = zero_bplanes + 1;
 1382|       |
 1383|    135|    if (lengths1 < 2 || (OPJ_UINT32)lengths1 > cblk_len ||
  ------------------
  |  Branch (1383:9): [True: 4, False: 131]
  |  Branch (1383:25): [True: 0, False: 131]
  ------------------
 1384|    135|            (OPJ_UINT32)(lengths1 + lengths2) > cblk_len) {
  ------------------
  |  Branch (1384:13): [True: 0, False: 131]
  ------------------
 1385|      4|        if (p_manager_mutex) {
  ------------------
  |  Branch (1385:13): [True: 4, False: 0]
  ------------------
 1386|      4|            opj_mutex_lock(p_manager_mutex);
 1387|      4|        }
 1388|      4|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1389|      4|                      "Invalid codeblock length values.\n");
 1390|       |
 1391|      4|        if (p_manager_mutex) {
  ------------------
  |  Branch (1391:13): [True: 4, False: 0]
  ------------------
 1392|      4|            opj_mutex_unlock(p_manager_mutex);
 1393|      4|        }
 1394|      4|        return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 1395|      4|    }
 1396|       |    // read scup and fix the bytes there
 1397|    131|    lcup = (int)lengths1;  // length of CUP
 1398|       |    //scup is the length of MEL + VLC
 1399|    131|    scup = (((int)coded_data[lcup - 1]) << 4) + (coded_data[lcup - 2] & 0xF);
 1400|    131|    if (scup < 2 || scup > lcup || scup > 4079) { //something is wrong
  ------------------
  |  Branch (1400:9): [True: 2, False: 129]
  |  Branch (1400:21): [True: 7, False: 122]
  |  Branch (1400:36): [True: 0, False: 122]
  ------------------
 1401|       |        /* The standard stipulates 2 <= Scup <= min(Lcup, 4079) */
 1402|      9|        if (p_manager_mutex) {
  ------------------
  |  Branch (1402:13): [True: 9, False: 0]
  ------------------
 1403|      9|            opj_mutex_lock(p_manager_mutex);
 1404|      9|        }
 1405|      9|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1406|      9|                      "One of the following condition is not met: "
 1407|      9|                      "2 <= Scup <= min(Lcup, 4079)\n");
 1408|       |
 1409|      9|        if (p_manager_mutex) {
  ------------------
  |  Branch (1409:13): [True: 9, False: 0]
  ------------------
 1410|      9|            opj_mutex_unlock(p_manager_mutex);
 1411|      9|        }
 1412|      9|        return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
 1413|      9|    }
 1414|       |
 1415|       |    // init structures
 1416|    122|    if (mel_init(&mel, coded_data, lcup, scup) == OPJ_FALSE) {
  ------------------
  |  |  118|    122|#define OPJ_FALSE 0
  ------------------
  |  Branch (1416:9): [True: 1, False: 121]
  ------------------
 1417|      1|        if (p_manager_mutex) {
  ------------------
  |  Branch (1417:13): [True: 1, False: 0]
  ------------------
 1418|      1|            opj_mutex_lock(p_manager_mutex);
 1419|      1|        }
 1420|      1|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1421|      1|                      "Incorrect MEL segment sequence.\n");
 1422|      1|        if (p_manager_mutex) {
  ------------------
  |  Branch (1422:13): [True: 1, False: 0]
  ------------------
 1423|      1|            opj_mutex_unlock(p_manager_mutex);
 1424|      1|        }
 1425|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1426|      1|    }
 1427|    121|    rev_init(&vlc, coded_data, lcup, scup);
 1428|    121|    frwd_init(&magsgn, coded_data, lcup - scup, 0xFF);
 1429|    121|    if (num_passes > 1) { // needs to be tested
  ------------------
  |  Branch (1429:9): [True: 86, False: 35]
  ------------------
 1430|     86|        frwd_init(&sigprop, coded_data + lengths1, (int)lengths2, 0);
 1431|     86|    }
 1432|    121|    if (num_passes > 2) {
  ------------------
  |  Branch (1432:9): [True: 76, False: 45]
  ------------------
 1433|     76|        rev_init_mrp(&magref, coded_data, (int)lengths1, (int)lengths2);
 1434|     76|    }
 1435|       |
 1436|       |    /** State storage
 1437|       |      *  One byte per quad; for 1024 columns, or 512 quads, we need
 1438|       |      *  512 bytes. We are using 2 extra bytes one on the left and one on
 1439|       |      *  the right for convenience.
 1440|       |      *
 1441|       |      *  The MSB bit in each byte is (\sigma^nw | \sigma^n), and the 7 LSBs
 1442|       |      *  contain max(E^nw | E^n)
 1443|       |      */
 1444|       |
 1445|       |    // 514 is enough for a block width of 1024, +2 extra
 1446|       |    // here expanded to 528
 1447|    121|    line_state = (OPJ_UINT8 *)(mbr2 + 132);
 1448|       |
 1449|       |    //initial 2 lines
 1450|       |    /////////////////
 1451|    121|    lsp = line_state;              // point to line state
 1452|    121|    lsp[0] = 0;                    // for initial row of quad, we set to 0
 1453|    121|    run = mel_get_run(&mel);    // decode runs of events from MEL bitstrm
 1454|       |    // data represented as runs of 0 events
 1455|       |    // See mel_decode description
 1456|    121|    qinf[0] = qinf[1] = 0;      // quad info decoded from VLC bitstream
 1457|    121|    c_q = 0;                    // context for quad q
 1458|    121|    sp = decoded_data;          // decoded codeblock samples
 1459|       |    // vlc_val;                 // fetched data from VLC bitstream
 1460|       |
 1461|  15.8k|    for (x = 0; x < width; x += 4) { // one iteration per quad pair
  ------------------
  |  Branch (1461:17): [True: 15.7k, False: 103]
  ------------------
 1462|  15.7k|        OPJ_UINT32 U_q[2]; // u values for the quad pair
 1463|  15.7k|        OPJ_UINT32 uvlc_mode;
 1464|  15.7k|        OPJ_UINT32 consumed_bits;
 1465|  15.7k|        OPJ_UINT32 m_n, v_n;
 1466|  15.7k|        OPJ_UINT32 ms_val;
 1467|  15.7k|        OPJ_UINT32 locs;
 1468|       |
 1469|       |        // decode VLC
 1470|       |        /////////////
 1471|       |
 1472|       |        //first quad
 1473|       |        // Get the head of the VLC bitstream. One fetch is enough for two
 1474|       |        // quads, since the largest VLC code is 7 bits, and maximum number of
 1475|       |        // bits used for u is 8.  Therefore for two quads we need 30 bits
 1476|       |        // (if we include unstuffing, then 32 bits are enough, since we have
 1477|       |        // a maximum of one stuffing per two bytes)
 1478|  15.7k|        vlc_val = rev_fetch(&vlc);
 1479|       |
 1480|       |        //decode VLC using the context c_q and the head of the VLC bitstream
 1481|  15.7k|        qinf[0] = vlc_tbl0[(c_q << 7) | (vlc_val & 0x7F) ];
 1482|       |
 1483|  15.7k|        if (c_q == 0) { // if zero context, we need to use one MEL event
  ------------------
  |  Branch (1483:13): [True: 7.30k, False: 8.44k]
  ------------------
 1484|  7.30k|            run -= 2; //the number of 0 events is multiplied by 2, so subtract 2
 1485|       |
 1486|       |            // Is the run terminated in 1? if so, use decoded VLC code,
 1487|       |            // otherwise, discard decoded data, since we will decoded again
 1488|       |            // using a different context
 1489|  7.30k|            qinf[0] = (run == -1) ? qinf[0] : 0;
  ------------------
  |  Branch (1489:23): [True: 1.70k, False: 5.60k]
  ------------------
 1490|       |
 1491|       |            // is run -1 or -2? this means a run has been consumed
 1492|  7.30k|            if (run < 0) {
  ------------------
  |  Branch (1492:17): [True: 2.65k, False: 4.64k]
  ------------------
 1493|  2.65k|                run = mel_get_run(&mel);    // get another run
 1494|  2.65k|            }
 1495|  7.30k|        }
 1496|       |
 1497|       |        // prepare context for the next quad; eqn. 1 in ITU T.814
 1498|  15.7k|        c_q = ((qinf[0] & 0x10) >> 4) | ((qinf[0] & 0xE0) >> 5);
 1499|       |
 1500|       |        //remove data from vlc stream (0 bits are removed if qinf is not used)
 1501|  15.7k|        vlc_val = rev_advance(&vlc, qinf[0] & 0x7);
 1502|       |
 1503|       |        //update sigma
 1504|       |        // The update depends on the value of x; consider one OPJ_UINT32
 1505|       |        // if x is 0, 8, 16 and so on, then this line update c locations
 1506|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1507|       |        //                         LSB   c c 0 0 0 0 0 0
 1508|       |        //                               c c 0 0 0 0 0 0
 1509|       |        //                               0 0 0 0 0 0 0 0
 1510|       |        //                               0 0 0 0 0 0 0 0
 1511|       |        // if x is 4, 12, 20, then this line update locations c
 1512|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1513|       |        //                         LSB   0 0 0 0 c c 0 0
 1514|       |        //                               0 0 0 0 c c 0 0
 1515|       |        //                               0 0 0 0 0 0 0 0
 1516|       |        //                               0 0 0 0 0 0 0 0
 1517|  15.7k|        *sip |= (((qinf[0] & 0x30) >> 4) | ((qinf[0] & 0xC0) >> 2)) << sip_shift;
 1518|       |
 1519|       |        //second quad
 1520|  15.7k|        qinf[1] = 0;
 1521|  15.7k|        if (x + 2 < width) { // do not run if codeblock is narrower
  ------------------
  |  Branch (1521:13): [True: 15.7k, False: 15]
  ------------------
 1522|       |            //decode VLC using the context c_q and the head of the VLC bitstream
 1523|  15.7k|            qinf[1] = vlc_tbl0[(c_q << 7) | (vlc_val & 0x7F)];
 1524|       |
 1525|       |            // if context is zero, use one MEL event
 1526|  15.7k|            if (c_q == 0) { //zero context
  ------------------
  |  Branch (1526:17): [True: 7.24k, False: 8.49k]
  ------------------
 1527|  7.24k|                run -= 2; //subtract 2, since events number if multiplied by 2
 1528|       |
 1529|       |                // if event is 0, discard decoded qinf
 1530|  7.24k|                qinf[1] = (run == -1) ? qinf[1] : 0;
  ------------------
  |  Branch (1530:27): [True: 1.63k, False: 5.60k]
  ------------------
 1531|       |
 1532|  7.24k|                if (run < 0) { // have we consumed all events in a run
  ------------------
  |  Branch (1532:21): [True: 2.55k, False: 4.69k]
  ------------------
 1533|  2.55k|                    run = mel_get_run(&mel);    // if yes, then get another run
 1534|  2.55k|                }
 1535|  7.24k|            }
 1536|       |
 1537|       |            //prepare context for the next quad, eqn. 1 in ITU T.814
 1538|  15.7k|            c_q = ((qinf[1] & 0x10) >> 4) | ((qinf[1] & 0xE0) >> 5);
 1539|       |
 1540|       |            //remove data from vlc stream, if qinf is not used, cwdlen is 0
 1541|  15.7k|            vlc_val = rev_advance(&vlc, qinf[1] & 0x7);
 1542|  15.7k|        }
 1543|       |
 1544|       |        //update sigma
 1545|       |        // The update depends on the value of x; consider one OPJ_UINT32
 1546|       |        // if x is 0, 8, 16 and so on, then this line update c locations
 1547|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1548|       |        //                         LSB   0 0 c c 0 0 0 0
 1549|       |        //                               0 0 c c 0 0 0 0
 1550|       |        //                               0 0 0 0 0 0 0 0
 1551|       |        //                               0 0 0 0 0 0 0 0
 1552|       |        // if x is 4, 12, 20, then this line update locations c
 1553|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1554|       |        //                         LSB   0 0 0 0 0 0 c c
 1555|       |        //                               0 0 0 0 0 0 c c
 1556|       |        //                               0 0 0 0 0 0 0 0
 1557|       |        //                               0 0 0 0 0 0 0 0
 1558|  15.7k|        *sip |= (((qinf[1] & 0x30) | ((qinf[1] & 0xC0) << 2))) << (4 + sip_shift);
 1559|       |
 1560|  15.7k|        sip += x & 0x7 ? 1 : 0; // move sigma pointer to next entry
  ------------------
  |  Branch (1560:16): [True: 7.84k, False: 7.90k]
  ------------------
 1561|  15.7k|        sip_shift ^= 0x10;      // increment/decrement sip_shift by 16
 1562|       |
 1563|       |        // retrieve u
 1564|       |        /////////////
 1565|       |
 1566|       |        // uvlc_mode is made up of u_offset bits from the quad pair
 1567|  15.7k|        uvlc_mode = ((qinf[0] & 0x8) >> 3) | ((qinf[1] & 0x8) >> 2);
 1568|  15.7k|        if (uvlc_mode == 3) { // if both u_offset are set, get an event from
  ------------------
  |  Branch (1568:13): [True: 5.31k, False: 10.4k]
  ------------------
 1569|       |            // the MEL run of events
 1570|  5.31k|            run -= 2; //subtract 2, since events number if multiplied by 2
 1571|  5.31k|            uvlc_mode += (run == -1) ? 1 : 0; //increment uvlc_mode if event is 1
  ------------------
  |  Branch (1571:26): [True: 2.39k, False: 2.91k]
  ------------------
 1572|  5.31k|            if (run < 0) { // if run is consumed (run is -1 or -2), get another run
  ------------------
  |  Branch (1572:17): [True: 3.34k, False: 1.97k]
  ------------------
 1573|  3.34k|                run = mel_get_run(&mel);
 1574|  3.34k|            }
 1575|  5.31k|        }
 1576|       |        //decode uvlc_mode to get u for both quads
 1577|  15.7k|        consumed_bits = decode_init_uvlc(vlc_val, uvlc_mode, U_q);
 1578|  15.7k|        if (U_q[0] > zero_bplanes_p1 || U_q[1] > zero_bplanes_p1) {
  ------------------
  |  Branch (1578:13): [True: 14, False: 15.7k]
  |  Branch (1578:41): [True: 3, False: 15.7k]
  ------------------
 1579|     17|            if (p_manager_mutex) {
  ------------------
  |  Branch (1579:17): [True: 17, False: 0]
  ------------------
 1580|     17|                opj_mutex_lock(p_manager_mutex);
 1581|     17|            }
 1582|     17|            opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. Decoding "
  ------------------
  |  |   66|     17|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1583|     17|                          "this codeblock is stopped. U_q is larger than zero "
 1584|     17|                          "bitplanes + 1 \n");
 1585|     17|            if (p_manager_mutex) {
  ------------------
  |  Branch (1585:17): [True: 17, False: 0]
  ------------------
 1586|     17|                opj_mutex_unlock(p_manager_mutex);
 1587|     17|            }
 1588|     17|            return OPJ_FALSE;
  ------------------
  |  |  118|     17|#define OPJ_FALSE 0
  ------------------
 1589|     17|        }
 1590|       |
 1591|       |        //consume u bits in the VLC code
 1592|  15.7k|        vlc_val = rev_advance(&vlc, consumed_bits);
 1593|       |
 1594|       |        //decode magsgn and update line_state
 1595|       |        /////////////////////////////////////
 1596|       |
 1597|       |        //We obtain a mask for the samples locations that needs evaluation
 1598|  15.7k|        locs = 0xFF;
 1599|  15.7k|        if (x + 4 > width) {
  ------------------
  |  Branch (1599:13): [True: 33, False: 15.7k]
  ------------------
 1600|     33|            locs >>= (x + 4 - width) << 1;    // limits width
 1601|     33|        }
 1602|  15.7k|        locs = height > 1 ? locs : (locs & 0x55);         // limits height
  ------------------
  |  Branch (1602:16): [True: 15.6k, False: 108]
  ------------------
 1603|       |
 1604|  15.7k|        if ((((qinf[0] & 0xF0) >> 4) | (qinf[1] & 0xF0)) & ~locs) {
  ------------------
  |  Branch (1604:13): [True: 1, False: 15.7k]
  ------------------
 1605|      1|            if (p_manager_mutex) {
  ------------------
  |  Branch (1605:17): [True: 1, False: 0]
  ------------------
 1606|      1|                opj_mutex_lock(p_manager_mutex);
 1607|      1|            }
 1608|      1|            opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1609|      1|                          "VLC code produces significant samples outside "
 1610|      1|                          "the codeblock area.\n");
 1611|      1|            if (p_manager_mutex) {
  ------------------
  |  Branch (1611:17): [True: 1, False: 0]
  ------------------
 1612|      1|                opj_mutex_unlock(p_manager_mutex);
 1613|      1|            }
 1614|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1615|      1|        }
 1616|       |
 1617|       |        //first quad, starting at first sample in quad and moving on
 1618|  15.7k|        if (qinf[0] & 0x10) { //is it significant? (sigma_n)
  ------------------
  |  Branch (1618:13): [True: 6.25k, False: 9.48k]
  ------------------
 1619|  6.25k|            OPJ_UINT32 val;
 1620|       |
 1621|  6.25k|            ms_val = frwd_fetch(&magsgn);         //get 32 bits of magsgn data
 1622|  6.25k|            m_n = U_q[0] - ((qinf[0] >> 12) & 1); //evaluate m_n (number of bits
 1623|       |            // to read from bitstream), using EMB e_k
 1624|  6.25k|            frwd_advance(&magsgn, m_n);         //consume m_n
 1625|  6.25k|            val = ms_val << 31;                 //get sign bit
 1626|  6.25k|            v_n = ms_val & ((1U << m_n) - 1);   //keep only m_n bits
 1627|  6.25k|            v_n |= ((qinf[0] & 0x100) >> 8) << m_n;  //add EMB e_1 as MSB
 1628|  6.25k|            v_n |= 1;                                //add center of bin
 1629|       |            //v_n now has 2 * (\mu - 1) + 0.5 with correct sign bit
 1630|       |            //add 2 to make it 2*\mu+0.5, shift it up to missing MSBs
 1631|  6.25k|            sp[0] = val | ((v_n + 2) << (p - 1));
 1632|  9.48k|        } else if (locs & 0x1) { // if this is inside the codeblock, set the
  ------------------
  |  Branch (1632:20): [True: 9.48k, False: 0]
  ------------------
 1633|  9.48k|            sp[0] = 0;           // sample to zero
 1634|  9.48k|        }
 1635|       |
 1636|  15.7k|        if (qinf[0] & 0x20) { //sigma_n
  ------------------
  |  Branch (1636:13): [True: 7.35k, False: 8.37k]
  ------------------
 1637|  7.35k|            OPJ_UINT32 val, t;
 1638|       |
 1639|  7.35k|            ms_val = frwd_fetch(&magsgn);         //get 32 bits
 1640|  7.35k|            m_n = U_q[0] - ((qinf[0] >> 13) & 1); //m_n, uses EMB e_k
 1641|  7.35k|            frwd_advance(&magsgn, m_n);           //consume m_n
 1642|  7.35k|            val = ms_val << 31;                   //get sign bit
 1643|  7.35k|            v_n = ms_val & ((1U << m_n) - 1);     //keep only m_n bits
 1644|  7.35k|            v_n |= ((qinf[0] & 0x200) >> 9) << m_n; //add EMB e_1
 1645|  7.35k|            v_n |= 1;                               //bin center
 1646|       |            //v_n now has 2 * (\mu - 1) + 0.5 with correct sign bit
 1647|       |            //add 2 to make it 2*\mu+0.5, shift it up to missing MSBs
 1648|  7.35k|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1649|       |
 1650|       |            //update line_state: bit 7 (\sigma^N), and E^N
 1651|  7.35k|            t = lsp[0] & 0x7F;       // keep E^NW
 1652|  7.35k|            v_n = 32 - count_leading_zeros(v_n);
 1653|  7.35k|            lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n)); //max(E^NW, E^N) | s
  ------------------
  |  Branch (1653:42): [True: 746, False: 6.61k]
  ------------------
 1654|  8.37k|        } else if (locs & 0x2) { // if this is inside the codeblock, set the
  ------------------
  |  Branch (1654:20): [True: 8.27k, False: 107]
  ------------------
 1655|  8.27k|            sp[stride] = 0;      // sample to zero
 1656|  8.27k|        }
 1657|       |
 1658|  15.7k|        ++lsp; // move to next quad information
 1659|  15.7k|        ++sp;  // move to next column of samples
 1660|       |
 1661|       |        //this is similar to the above two samples
 1662|  15.7k|        if (qinf[0] & 0x40) {
  ------------------
  |  Branch (1662:13): [True: 4.51k, False: 11.2k]
  ------------------
 1663|  4.51k|            OPJ_UINT32 val;
 1664|       |
 1665|  4.51k|            ms_val = frwd_fetch(&magsgn);
 1666|  4.51k|            m_n = U_q[0] - ((qinf[0] >> 14) & 1);
 1667|  4.51k|            frwd_advance(&magsgn, m_n);
 1668|  4.51k|            val = ms_val << 31;
 1669|  4.51k|            v_n = ms_val & ((1U << m_n) - 1);
 1670|  4.51k|            v_n |= (((qinf[0] & 0x400) >> 10) << m_n);
 1671|  4.51k|            v_n |= 1;
 1672|  4.51k|            sp[0] = val | ((v_n + 2) << (p - 1));
 1673|  11.2k|        } else if (locs & 0x4) {
  ------------------
  |  Branch (1673:20): [True: 11.2k, False: 4]
  ------------------
 1674|  11.2k|            sp[0] = 0;
 1675|  11.2k|        }
 1676|       |
 1677|  15.7k|        lsp[0] = 0;
 1678|  15.7k|        if (qinf[0] & 0x80) {
  ------------------
  |  Branch (1678:13): [True: 6.44k, False: 9.28k]
  ------------------
 1679|  6.44k|            OPJ_UINT32 val;
 1680|  6.44k|            ms_val = frwd_fetch(&magsgn);
 1681|  6.44k|            m_n = U_q[0] - ((qinf[0] >> 15) & 1); //m_n
 1682|  6.44k|            frwd_advance(&magsgn, m_n);
 1683|  6.44k|            val = ms_val << 31;
 1684|  6.44k|            v_n = ms_val & ((1U << m_n) - 1);
 1685|  6.44k|            v_n |= ((qinf[0] & 0x800) >> 11) << m_n;
 1686|  6.44k|            v_n |= 1; //center of bin
 1687|  6.44k|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1688|       |
 1689|       |            //line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1690|  6.44k|            lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1691|  9.28k|        } else if (locs & 0x8) { //if outside set to 0
  ------------------
  |  Branch (1691:20): [True: 9.17k, False: 111]
  ------------------
 1692|  9.17k|            sp[stride] = 0;
 1693|  9.17k|        }
 1694|       |
 1695|  15.7k|        ++sp; //move to next column
 1696|       |
 1697|       |        //second quad
 1698|  15.7k|        if (qinf[1] & 0x10) {
  ------------------
  |  Branch (1698:13): [True: 5.81k, False: 9.91k]
  ------------------
 1699|  5.81k|            OPJ_UINT32 val;
 1700|       |
 1701|  5.81k|            ms_val = frwd_fetch(&magsgn);
 1702|  5.81k|            m_n = U_q[1] - ((qinf[1] >> 12) & 1); //m_n
 1703|  5.81k|            frwd_advance(&magsgn, m_n);
 1704|  5.81k|            val = ms_val << 31;
 1705|  5.81k|            v_n = ms_val & ((1U << m_n) - 1);
 1706|  5.81k|            v_n |= (((qinf[1] & 0x100) >> 8) << m_n);
 1707|  5.81k|            v_n |= 1;
 1708|  5.81k|            sp[0] = val | ((v_n + 2) << (p - 1));
 1709|  9.91k|        } else if (locs & 0x10) {
  ------------------
  |  Branch (1709:20): [True: 9.90k, False: 15]
  ------------------
 1710|  9.90k|            sp[0] = 0;
 1711|  9.90k|        }
 1712|       |
 1713|  15.7k|        if (qinf[1] & 0x20) {
  ------------------
  |  Branch (1713:13): [True: 7.66k, False: 8.06k]
  ------------------
 1714|  7.66k|            OPJ_UINT32 val, t;
 1715|       |
 1716|  7.66k|            ms_val = frwd_fetch(&magsgn);
 1717|  7.66k|            m_n = U_q[1] - ((qinf[1] >> 13) & 1); //m_n
 1718|  7.66k|            frwd_advance(&magsgn, m_n);
 1719|  7.66k|            val = ms_val << 31;
 1720|  7.66k|            v_n = ms_val & ((1U << m_n) - 1);
 1721|  7.66k|            v_n |= (((qinf[1] & 0x200) >> 9) << m_n);
 1722|  7.66k|            v_n |= 1;
 1723|  7.66k|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1724|       |
 1725|       |            //update line_state: bit 7 (\sigma^N), and E^N
 1726|  7.66k|            t = lsp[0] & 0x7F;            //E^NW
 1727|  7.66k|            v_n = 32 - count_leading_zeros(v_n);     //E^N
 1728|  7.66k|            lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n)); //max(E^NW, E^N) | s
  ------------------
  |  Branch (1728:42): [True: 2.76k, False: 4.90k]
  ------------------
 1729|  8.06k|        } else if (locs & 0x20) {
  ------------------
  |  Branch (1729:20): [True: 7.94k, False: 121]
  ------------------
 1730|  7.94k|            sp[stride] = 0;    //no need to update line_state
 1731|  7.94k|        }
 1732|       |
 1733|  15.7k|        ++lsp; //move line state to next quad
 1734|  15.7k|        ++sp;  //move to next sample
 1735|       |
 1736|  15.7k|        if (qinf[1] & 0x40) {
  ------------------
  |  Branch (1736:13): [True: 6.09k, False: 9.63k]
  ------------------
 1737|  6.09k|            OPJ_UINT32 val;
 1738|       |
 1739|  6.09k|            ms_val = frwd_fetch(&magsgn);
 1740|  6.09k|            m_n = U_q[1] - ((qinf[1] >> 14) & 1); //m_n
 1741|  6.09k|            frwd_advance(&magsgn, m_n);
 1742|  6.09k|            val = ms_val << 31;
 1743|  6.09k|            v_n = ms_val & ((1U << m_n) - 1);
 1744|  6.09k|            v_n |= (((qinf[1] & 0x400) >> 10) << m_n);
 1745|  6.09k|            v_n |= 1;
 1746|  6.09k|            sp[0] = val | ((v_n + 2) << (p - 1));
 1747|  9.63k|        } else if (locs & 0x40) {
  ------------------
  |  Branch (1747:20): [True: 9.60k, False: 33]
  ------------------
 1748|  9.60k|            sp[0] = 0;
 1749|  9.60k|        }
 1750|       |
 1751|  15.7k|        lsp[0] = 0;
 1752|  15.7k|        if (qinf[1] & 0x80) {
  ------------------
  |  Branch (1752:13): [True: 5.23k, False: 10.4k]
  ------------------
 1753|  5.23k|            OPJ_UINT32 val;
 1754|       |
 1755|  5.23k|            ms_val = frwd_fetch(&magsgn);
 1756|  5.23k|            m_n = U_q[1] - ((qinf[1] >> 15) & 1); //m_n
 1757|  5.23k|            frwd_advance(&magsgn, m_n);
 1758|  5.23k|            val = ms_val << 31;
 1759|  5.23k|            v_n = ms_val & ((1U << m_n) - 1);
 1760|  5.23k|            v_n |= (((qinf[1] & 0x800) >> 11) << m_n);
 1761|  5.23k|            v_n |= 1; //center of bin
 1762|  5.23k|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1763|       |
 1764|       |            //line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1765|  5.23k|            lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1766|  10.4k|        } else if (locs & 0x80) {
  ------------------
  |  Branch (1766:20): [True: 10.3k, False: 138]
  ------------------
 1767|  10.3k|            sp[stride] = 0;
 1768|  10.3k|        }
 1769|       |
 1770|  15.7k|        ++sp;
 1771|  15.7k|    }
 1772|       |
 1773|       |    //non-initial lines
 1774|       |    //////////////////////////
 1775|    503|    for (y = 2; y < height; /*done at the end of loop*/) {
  ------------------
  |  Branch (1775:17): [True: 420, False: 83]
  ------------------
 1776|    420|        OPJ_UINT32 *sip;
 1777|    420|        OPJ_UINT8 ls0;
 1778|    420|        OPJ_INT32 x;
 1779|       |
 1780|    420|        sip_shift ^= 0x2;  // shift sigma to the upper half od the nibble
 1781|    420|        sip_shift &= 0xFFFFFFEFU; //move back to 0 (it might have been at 0x10)
 1782|    420|        sip = y & 0x4 ? sigma2 : sigma1; //choose sigma array
  ------------------
  |  Branch (1782:15): [True: 183, False: 237]
  ------------------
 1783|       |
 1784|    420|        lsp = line_state;
 1785|    420|        ls0 = lsp[0];                   // read the line state value
 1786|    420|        lsp[0] = 0;                     // and set it to zero
 1787|    420|        sp = decoded_data + y * stride; // generated samples
 1788|    420|        c_q = 0;                        // context
 1789|  13.8k|        for (x = 0; x < width; x += 4) {
  ------------------
  |  Branch (1789:21): [True: 13.4k, False: 400]
  ------------------
 1790|  13.4k|            OPJ_UINT32 U_q[2];
 1791|  13.4k|            OPJ_UINT32 uvlc_mode, consumed_bits;
 1792|  13.4k|            OPJ_UINT32 m_n, v_n;
 1793|  13.4k|            OPJ_UINT32 ms_val;
 1794|  13.4k|            OPJ_UINT32 locs;
 1795|       |
 1796|       |            // decode vlc
 1797|       |            /////////////
 1798|       |
 1799|       |            //first quad
 1800|       |            // get context, eqn. 2 ITU T.814
 1801|       |            // c_q has \sigma^W | \sigma^SW
 1802|  13.4k|            c_q |= (ls0 >> 7);          //\sigma^NW | \sigma^N
 1803|  13.4k|            c_q |= (lsp[1] >> 5) & 0x4; //\sigma^NE | \sigma^NF
 1804|       |
 1805|       |            //the following is very similar to previous code, so please refer to
 1806|       |            // that
 1807|  13.4k|            vlc_val = rev_fetch(&vlc);
 1808|  13.4k|            qinf[0] = vlc_tbl1[(c_q << 7) | (vlc_val & 0x7F)];
 1809|  13.4k|            if (c_q == 0) { //zero context
  ------------------
  |  Branch (1809:17): [True: 5.48k, False: 7.97k]
  ------------------
 1810|  5.48k|                run -= 2;
 1811|  5.48k|                qinf[0] = (run == -1) ? qinf[0] : 0;
  ------------------
  |  Branch (1811:27): [True: 677, False: 4.80k]
  ------------------
 1812|  5.48k|                if (run < 0) {
  ------------------
  |  Branch (1812:21): [True: 1.12k, False: 4.35k]
  ------------------
 1813|  1.12k|                    run = mel_get_run(&mel);
 1814|  1.12k|                }
 1815|  5.48k|            }
 1816|       |            //prepare context for the next quad, \sigma^W | \sigma^SW
 1817|  13.4k|            c_q = ((qinf[0] & 0x40) >> 5) | ((qinf[0] & 0x80) >> 6);
 1818|       |
 1819|       |            //remove data from vlc stream
 1820|  13.4k|            vlc_val = rev_advance(&vlc, qinf[0] & 0x7);
 1821|       |
 1822|       |            //update sigma
 1823|       |            // The update depends on the value of x and y; consider one OPJ_UINT32
 1824|       |            // if x is 0, 8, 16 and so on, and y is 2, 6, etc., then this
 1825|       |            // line update c locations
 1826|       |            //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1827|       |            //                         LSB   0 0 0 0 0 0 0 0
 1828|       |            //                               0 0 0 0 0 0 0 0
 1829|       |            //                               c c 0 0 0 0 0 0
 1830|       |            //                               c c 0 0 0 0 0 0
 1831|  13.4k|            *sip |= (((qinf[0] & 0x30) >> 4) | ((qinf[0] & 0xC0) >> 2)) << sip_shift;
 1832|       |
 1833|       |            //second quad
 1834|  13.4k|            qinf[1] = 0;
 1835|  13.4k|            if (x + 2 < width) {
  ------------------
  |  Branch (1835:17): [True: 13.3k, False: 135]
  ------------------
 1836|  13.3k|                c_q |= (lsp[1] >> 7);
 1837|  13.3k|                c_q |= (lsp[2] >> 5) & 0x4;
 1838|  13.3k|                qinf[1] = vlc_tbl1[(c_q << 7) | (vlc_val & 0x7F)];
 1839|  13.3k|                if (c_q == 0) { //zero context
  ------------------
  |  Branch (1839:21): [True: 5.34k, False: 7.98k]
  ------------------
 1840|  5.34k|                    run -= 2;
 1841|  5.34k|                    qinf[1] = (run == -1) ? qinf[1] : 0;
  ------------------
  |  Branch (1841:31): [True: 661, False: 4.67k]
  ------------------
 1842|  5.34k|                    if (run < 0) {
  ------------------
  |  Branch (1842:25): [True: 1.02k, False: 4.32k]
  ------------------
 1843|  1.02k|                        run = mel_get_run(&mel);
 1844|  1.02k|                    }
 1845|  5.34k|                }
 1846|       |                //prepare context for the next quad
 1847|  13.3k|                c_q = ((qinf[1] & 0x40) >> 5) | ((qinf[1] & 0x80) >> 6);
 1848|       |                //remove data from vlc stream
 1849|  13.3k|                vlc_val = rev_advance(&vlc, qinf[1] & 0x7);
 1850|  13.3k|            }
 1851|       |
 1852|       |            //update sigma
 1853|  13.4k|            *sip |= (((qinf[1] & 0x30) | ((qinf[1] & 0xC0) << 2))) << (4 + sip_shift);
 1854|       |
 1855|  13.4k|            sip += x & 0x7 ? 1 : 0;
  ------------------
  |  Branch (1855:20): [True: 6.63k, False: 6.81k]
  ------------------
 1856|  13.4k|            sip_shift ^= 0x10;
 1857|       |
 1858|       |            //retrieve u
 1859|       |            ////////////
 1860|  13.4k|            uvlc_mode = ((qinf[0] & 0x8) >> 3) | ((qinf[1] & 0x8) >> 2);
 1861|  13.4k|            consumed_bits = decode_noninit_uvlc(vlc_val, uvlc_mode, U_q);
 1862|  13.4k|            vlc_val = rev_advance(&vlc, consumed_bits);
 1863|       |
 1864|       |            //calculate E^max and add it to U_q, eqns 5 and 6 in ITU T.814
 1865|  13.4k|            if ((qinf[0] & 0xF0) & ((qinf[0] & 0xF0) - 1)) { // is \gamma_q 1?
  ------------------
  |  Branch (1865:17): [True: 2.38k, False: 11.0k]
  ------------------
 1866|  2.38k|                OPJ_UINT32 E = (ls0 & 0x7Fu);
 1867|  2.38k|                E = E > (lsp[1] & 0x7Fu) ? E : (lsp[1] & 0x7Fu); //max(E, E^NE, E^NF)
  ------------------
  |  Branch (1867:21): [True: 1.12k, False: 1.25k]
  ------------------
 1868|       |                //since U_q already has u_q + 1, we subtract 2 instead of 1
 1869|  2.38k|                U_q[0] += E > 2 ? E - 2 : 0;
  ------------------
  |  Branch (1869:27): [True: 1.98k, False: 402]
  ------------------
 1870|  2.38k|            }
 1871|       |
 1872|  13.4k|            if ((qinf[1] & 0xF0) & ((qinf[1] & 0xF0) - 1)) { //is \gamma_q 1?
  ------------------
  |  Branch (1872:17): [True: 2.19k, False: 11.2k]
  ------------------
 1873|  2.19k|                OPJ_UINT32 E = (lsp[1] & 0x7Fu);
 1874|  2.19k|                E = E > (lsp[2] & 0x7Fu) ? E : (lsp[2] & 0x7Fu); //max(E, E^NE, E^NF)
  ------------------
  |  Branch (1874:21): [True: 484, False: 1.70k]
  ------------------
 1875|       |                //since U_q already has u_q + 1, we subtract 2 instead of 1
 1876|  2.19k|                U_q[1] += E > 2 ? E - 2 : 0;
  ------------------
  |  Branch (1876:27): [True: 1.80k, False: 392]
  ------------------
 1877|  2.19k|            }
 1878|       |
 1879|  13.4k|            if (U_q[0] > zero_bplanes_p1 || U_q[1] > zero_bplanes_p1) {
  ------------------
  |  Branch (1879:17): [True: 6, False: 13.4k]
  |  Branch (1879:45): [True: 9, False: 13.4k]
  ------------------
 1880|     15|                if (p_manager_mutex) {
  ------------------
  |  Branch (1880:21): [True: 15, False: 0]
  ------------------
 1881|     15|                    opj_mutex_lock(p_manager_mutex);
 1882|     15|                }
 1883|     15|                opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|     15|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1884|     15|                              "Decoding this codeblock is stopped. U_q is"
 1885|     15|                              "larger than bitplanes + 1 \n");
 1886|     15|                if (p_manager_mutex) {
  ------------------
  |  Branch (1886:21): [True: 15, False: 0]
  ------------------
 1887|     15|                    opj_mutex_unlock(p_manager_mutex);
 1888|     15|                }
 1889|     15|                return OPJ_FALSE;
  ------------------
  |  |  118|     15|#define OPJ_FALSE 0
  ------------------
 1890|     15|            }
 1891|       |
 1892|  13.4k|            ls0 = lsp[2]; //for next double quad
 1893|  13.4k|            lsp[1] = lsp[2] = 0;
 1894|       |
 1895|       |            //decode magsgn and update line_state
 1896|       |            /////////////////////////////////////
 1897|       |
 1898|       |            //locations where samples need update
 1899|  13.4k|            locs = 0xFF;
 1900|  13.4k|            if (x + 4 > width) {
  ------------------
  |  Branch (1900:17): [True: 160, False: 13.2k]
  ------------------
 1901|    160|                locs >>= (x + 4 - width) << 1;
 1902|    160|            }
 1903|  13.4k|            locs = y + 2 <= height ? locs : (locs & 0x55);
  ------------------
  |  Branch (1903:20): [True: 13.4k, False: 3]
  ------------------
 1904|       |
 1905|  13.4k|            if ((((qinf[0] & 0xF0) >> 4) | (qinf[1] & 0xF0)) & ~locs) {
  ------------------
  |  Branch (1905:17): [True: 5, False: 13.4k]
  ------------------
 1906|      5|                if (p_manager_mutex) {
  ------------------
  |  Branch (1906:21): [True: 5, False: 0]
  ------------------
 1907|      5|                    opj_mutex_lock(p_manager_mutex);
 1908|      5|                }
 1909|      5|                opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1910|      5|                              "VLC code produces significant samples outside "
 1911|      5|                              "the codeblock area.\n");
 1912|      5|                if (p_manager_mutex) {
  ------------------
  |  Branch (1912:21): [True: 5, False: 0]
  ------------------
 1913|      5|                    opj_mutex_unlock(p_manager_mutex);
 1914|      5|                }
 1915|      5|                return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 1916|      5|            }
 1917|       |
 1918|       |
 1919|       |
 1920|  13.4k|            if (qinf[0] & 0x10) { //sigma_n
  ------------------
  |  Branch (1920:17): [True: 2.80k, False: 10.6k]
  ------------------
 1921|  2.80k|                OPJ_UINT32 val;
 1922|       |
 1923|  2.80k|                ms_val = frwd_fetch(&magsgn);
 1924|  2.80k|                m_n = U_q[0] - ((qinf[0] >> 12) & 1); //m_n
 1925|  2.80k|                frwd_advance(&magsgn, m_n);
 1926|  2.80k|                val = ms_val << 31;
 1927|  2.80k|                v_n = ms_val & ((1U << m_n) - 1);
 1928|  2.80k|                v_n |= ((qinf[0] & 0x100) >> 8) << m_n;
 1929|  2.80k|                v_n |= 1; //center of bin
 1930|  2.80k|                sp[0] = val | ((v_n + 2) << (p - 1));
 1931|  10.6k|            } else if (locs & 0x1) {
  ------------------
  |  Branch (1931:24): [True: 10.6k, False: 0]
  ------------------
 1932|  10.6k|                sp[0] = 0;
 1933|  10.6k|            }
 1934|       |
 1935|  13.4k|            if (qinf[0] & 0x20) { //sigma_n
  ------------------
  |  Branch (1935:17): [True: 1.69k, False: 11.7k]
  ------------------
 1936|  1.69k|                OPJ_UINT32 val, t;
 1937|       |
 1938|  1.69k|                ms_val = frwd_fetch(&magsgn);
 1939|  1.69k|                m_n = U_q[0] - ((qinf[0] >> 13) & 1); //m_n
 1940|  1.69k|                frwd_advance(&magsgn, m_n);
 1941|  1.69k|                val = ms_val << 31;
 1942|  1.69k|                v_n = ms_val & ((1U << m_n) - 1);
 1943|  1.69k|                v_n |= ((qinf[0] & 0x200) >> 9) << m_n;
 1944|  1.69k|                v_n |= 1; //center of bin
 1945|  1.69k|                sp[stride] = val | ((v_n + 2) << (p - 1));
 1946|       |
 1947|       |                //update line_state: bit 7 (\sigma^N), and E^N
 1948|  1.69k|                t = lsp[0] & 0x7F;          //E^NW
 1949|  1.69k|                v_n = 32 - count_leading_zeros(v_n);
 1950|  1.69k|                lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n));
  ------------------
  |  Branch (1950:46): [True: 239, False: 1.45k]
  ------------------
 1951|  11.7k|            } else if (locs & 0x2) {
  ------------------
  |  Branch (1951:24): [True: 11.7k, False: 3]
  ------------------
 1952|  11.7k|                sp[stride] = 0;    //no need to update line_state
 1953|  11.7k|            }
 1954|       |
 1955|  13.4k|            ++lsp;
 1956|  13.4k|            ++sp;
 1957|       |
 1958|  13.4k|            if (qinf[0] & 0x40) { //sigma_n
  ------------------
  |  Branch (1958:17): [True: 2.08k, False: 11.3k]
  ------------------
 1959|  2.08k|                OPJ_UINT32 val;
 1960|       |
 1961|  2.08k|                ms_val = frwd_fetch(&magsgn);
 1962|  2.08k|                m_n = U_q[0] - ((qinf[0] >> 14) & 1); //m_n
 1963|  2.08k|                frwd_advance(&magsgn, m_n);
 1964|  2.08k|                val = ms_val << 31;
 1965|  2.08k|                v_n = ms_val & ((1U << m_n) - 1);
 1966|  2.08k|                v_n |= (((qinf[0] & 0x400) >> 10) << m_n);
 1967|  2.08k|                v_n |= 1;                            //center of bin
 1968|  2.08k|                sp[0] = val | ((v_n + 2) << (p - 1));
 1969|  11.3k|            } else if (locs & 0x4) {
  ------------------
  |  Branch (1969:24): [True: 11.2k, False: 68]
  ------------------
 1970|  11.2k|                sp[0] = 0;
 1971|  11.2k|            }
 1972|       |
 1973|  13.4k|            if (qinf[0] & 0x80) { //sigma_n
  ------------------
  |  Branch (1973:17): [True: 2.15k, False: 11.2k]
  ------------------
 1974|  2.15k|                OPJ_UINT32 val;
 1975|       |
 1976|  2.15k|                ms_val = frwd_fetch(&magsgn);
 1977|  2.15k|                m_n = U_q[0] - ((qinf[0] >> 15) & 1); //m_n
 1978|  2.15k|                frwd_advance(&magsgn, m_n);
 1979|  2.15k|                val = ms_val << 31;
 1980|  2.15k|                v_n = ms_val & ((1U << m_n) - 1);
 1981|  2.15k|                v_n |= ((qinf[0] & 0x800) >> 11) << m_n;
 1982|  2.15k|                v_n |= 1; //center of bin
 1983|  2.15k|                sp[stride] = val | ((v_n + 2) << (p - 1));
 1984|       |
 1985|       |                //update line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1986|  2.15k|                lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1987|  11.2k|            } else if (locs & 0x8) {
  ------------------
  |  Branch (1987:24): [True: 11.2k, False: 71]
  ------------------
 1988|  11.2k|                sp[stride] = 0;
 1989|  11.2k|            }
 1990|       |
 1991|  13.4k|            ++sp;
 1992|       |
 1993|  13.4k|            if (qinf[1] & 0x10) { //sigma_n
  ------------------
  |  Branch (1993:17): [True: 2.52k, False: 10.9k]
  ------------------
 1994|  2.52k|                OPJ_UINT32 val;
 1995|       |
 1996|  2.52k|                ms_val = frwd_fetch(&magsgn);
 1997|  2.52k|                m_n = U_q[1] - ((qinf[1] >> 12) & 1); //m_n
 1998|  2.52k|                frwd_advance(&magsgn, m_n);
 1999|  2.52k|                val = ms_val << 31;
 2000|  2.52k|                v_n = ms_val & ((1U << m_n) - 1);
 2001|  2.52k|                v_n |= (((qinf[1] & 0x100) >> 8) << m_n);
 2002|  2.52k|                v_n |= 1;                            //center of bin
 2003|  2.52k|                sp[0] = val | ((v_n + 2) << (p - 1));
 2004|  10.9k|            } else if (locs & 0x10) {
  ------------------
  |  Branch (2004:24): [True: 10.7k, False: 132]
  ------------------
 2005|  10.7k|                sp[0] = 0;
 2006|  10.7k|            }
 2007|       |
 2008|  13.4k|            if (qinf[1] & 0x20) { //sigma_n
  ------------------
  |  Branch (2008:17): [True: 1.73k, False: 11.7k]
  ------------------
 2009|  1.73k|                OPJ_UINT32 val, t;
 2010|       |
 2011|  1.73k|                ms_val = frwd_fetch(&magsgn);
 2012|  1.73k|                m_n = U_q[1] - ((qinf[1] >> 13) & 1); //m_n
 2013|  1.73k|                frwd_advance(&magsgn, m_n);
 2014|  1.73k|                val = ms_val << 31;
 2015|  1.73k|                v_n = ms_val & ((1U << m_n) - 1);
 2016|  1.73k|                v_n |= (((qinf[1] & 0x200) >> 9) << m_n);
 2017|  1.73k|                v_n |= 1; //center of bin
 2018|  1.73k|                sp[stride] = val | ((v_n + 2) << (p - 1));
 2019|       |
 2020|       |                //update line_state: bit 7 (\sigma^N), and E^N
 2021|  1.73k|                t = lsp[0] & 0x7F;          //E^NW
 2022|  1.73k|                v_n = 32 - count_leading_zeros(v_n);
 2023|  1.73k|                lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n));
  ------------------
  |  Branch (2023:46): [True: 459, False: 1.27k]
  ------------------
 2024|  11.7k|            } else if (locs & 0x20) {
  ------------------
  |  Branch (2024:24): [True: 11.5k, False: 134]
  ------------------
 2025|  11.5k|                sp[stride] = 0;    //no need to update line_state
 2026|  11.5k|            }
 2027|       |
 2028|  13.4k|            ++lsp;
 2029|  13.4k|            ++sp;
 2030|       |
 2031|  13.4k|            if (qinf[1] & 0x40) { //sigma_n
  ------------------
  |  Branch (2031:17): [True: 954, False: 12.4k]
  ------------------
 2032|    954|                OPJ_UINT32 val;
 2033|       |
 2034|    954|                ms_val = frwd_fetch(&magsgn);
 2035|    954|                m_n = U_q[1] - ((qinf[1] >> 14) & 1); //m_n
 2036|    954|                frwd_advance(&magsgn, m_n);
 2037|    954|                val = ms_val << 31;
 2038|    954|                v_n = ms_val & ((1U << m_n) - 1);
 2039|    954|                v_n |= (((qinf[1] & 0x400) >> 10) << m_n);
 2040|    954|                v_n |= 1;                            //center of bin
 2041|    954|                sp[0] = val | ((v_n + 2) << (p - 1));
 2042|  12.4k|            } else if (locs & 0x40) {
  ------------------
  |  Branch (2042:24): [True: 12.3k, False: 155]
  ------------------
 2043|  12.3k|                sp[0] = 0;
 2044|  12.3k|            }
 2045|       |
 2046|  13.4k|            if (qinf[1] & 0x80) { //sigma_n
  ------------------
  |  Branch (2046:17): [True: 2.19k, False: 11.2k]
  ------------------
 2047|  2.19k|                OPJ_UINT32 val;
 2048|       |
 2049|  2.19k|                ms_val = frwd_fetch(&magsgn);
 2050|  2.19k|                m_n = U_q[1] - ((qinf[1] >> 15) & 1); //m_n
 2051|  2.19k|                frwd_advance(&magsgn, m_n);
 2052|  2.19k|                val = ms_val << 31;
 2053|  2.19k|                v_n = ms_val & ((1U << m_n) - 1);
 2054|  2.19k|                v_n |= (((qinf[1] & 0x800) >> 11) << m_n);
 2055|  2.19k|                v_n |= 1; //center of bin
 2056|  2.19k|                sp[stride] = val | ((v_n + 2) << (p - 1));
 2057|       |
 2058|       |                //update line_state: bit 7 (\sigma^NW), and E^NW for next quad
 2059|  2.19k|                lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 2060|  11.2k|            } else if (locs & 0x80) {
  ------------------
  |  Branch (2060:24): [True: 11.0k, False: 157]
  ------------------
 2061|  11.0k|                sp[stride] = 0;
 2062|  11.0k|            }
 2063|       |
 2064|  13.4k|            ++sp;
 2065|  13.4k|        }
 2066|       |
 2067|    400|        y += 2;
 2068|    400|        if (num_passes > 1 && (y & 3) == 0) { //executed at multiples of 4
  ------------------
  |  Branch (2068:13): [True: 53, False: 347]
  |  Branch (2068:31): [True: 53, False: 0]
  ------------------
 2069|       |            // This is for SPP and potentially MRP
 2070|       |
 2071|     53|            if (num_passes > 2) { //do MRP
  ------------------
  |  Branch (2071:17): [True: 47, False: 6]
  ------------------
 2072|       |                // select the current stripe
 2073|     47|                OPJ_UINT32 *cur_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2073:39): [True: 47, False: 0]
  ------------------
 2074|       |                // the address of the data that needs updating
 2075|     47|                OPJ_UINT32 *dpp = decoded_data + (y - 4) * stride;
 2076|     47|                OPJ_UINT32 half = 1u << (p - 2); // half the center of the bin
 2077|     47|                OPJ_INT32 i;
 2078|  4.85k|                for (i = 0; i < width; i += 8) {
  ------------------
  |  Branch (2078:29): [True: 4.80k, False: 47]
  ------------------
 2079|       |                    //Process one entry from sigma array at a time
 2080|       |                    // Each nibble (4 bits) in the sigma array represents 4 rows,
 2081|       |                    // and the 32 bits contain 8 columns
 2082|  4.80k|                    OPJ_UINT32 cwd = rev_fetch_mrp(&magref); // get 32 bit data
 2083|  4.80k|                    OPJ_UINT32 sig = *cur_sig++; // 32 bit that will be processed now
 2084|  4.80k|                    OPJ_UINT32 col_mask = 0xFu;  // a mask for a column in sig
 2085|  4.80k|                    OPJ_UINT32 *dp = dpp + i;    // next column in decode samples
 2086|  4.80k|                    if (sig) { // if any of the 32 bits are set
  ------------------
  |  Branch (2086:25): [True: 3.51k, False: 1.29k]
  ------------------
 2087|  3.51k|                        int j;
 2088|  31.6k|                        for (j = 0; j < 8; ++j, dp++) { //one column at a time
  ------------------
  |  Branch (2088:37): [True: 28.0k, False: 3.51k]
  ------------------
 2089|  28.0k|                            if (sig & col_mask) { // lowest nibble
  ------------------
  |  Branch (2089:33): [True: 21.2k, False: 6.87k]
  ------------------
 2090|  21.2k|                                OPJ_UINT32 sample_mask = 0x11111111u & col_mask; //LSB
 2091|       |
 2092|  21.2k|                                if (sig & sample_mask) { //if LSB is set
  ------------------
  |  Branch (2092:37): [True: 16.3k, False: 4.87k]
  ------------------
 2093|  16.3k|                                    OPJ_UINT32 sym;
 2094|       |
 2095|  16.3k|                                    assert(dp[0] != 0); // decoded value cannot be zero
 2096|  16.3k|                                    sym = cwd & 1; // get it value
 2097|       |                                    // remove center of bin if sym is 0
 2098|  16.3k|                                    dp[0] ^= (1 - sym) << (p - 1);
 2099|  16.3k|                                    dp[0] |= half;      // put half the center of bin
 2100|  16.3k|                                    cwd >>= 1;          //consume word
 2101|  16.3k|                                }
 2102|  21.2k|                                sample_mask += sample_mask; //next row
 2103|       |
 2104|  21.2k|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2104:37): [True: 17.5k, False: 3.70k]
  ------------------
 2105|  17.5k|                                    OPJ_UINT32 sym;
 2106|       |
 2107|  17.5k|                                    assert(dp[stride] != 0);
 2108|  17.5k|                                    sym = cwd & 1;
 2109|  17.5k|                                    dp[stride] ^= (1 - sym) << (p - 1);
 2110|  17.5k|                                    dp[stride] |= half;
 2111|  17.5k|                                    cwd >>= 1;
 2112|  17.5k|                                }
 2113|  21.2k|                                sample_mask += sample_mask;
 2114|       |
 2115|  21.2k|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2115:37): [True: 6.05k, False: 15.1k]
  ------------------
 2116|  6.05k|                                    OPJ_UINT32 sym;
 2117|       |
 2118|  6.05k|                                    assert(dp[2 * stride] != 0);
 2119|  6.05k|                                    sym = cwd & 1;
 2120|  6.05k|                                    dp[2 * stride] ^= (1 - sym) << (p - 1);
 2121|  6.05k|                                    dp[2 * stride] |= half;
 2122|  6.05k|                                    cwd >>= 1;
 2123|  6.05k|                                }
 2124|  21.2k|                                sample_mask += sample_mask;
 2125|       |
 2126|  21.2k|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2126:37): [True: 5.22k, False: 15.9k]
  ------------------
 2127|  5.22k|                                    OPJ_UINT32 sym;
 2128|       |
 2129|  5.22k|                                    assert(dp[3 * stride] != 0);
 2130|  5.22k|                                    sym = cwd & 1;
 2131|  5.22k|                                    dp[3 * stride] ^= (1 - sym) << (p - 1);
 2132|  5.22k|                                    dp[3 * stride] |= half;
 2133|  5.22k|                                    cwd >>= 1;
 2134|  5.22k|                                }
 2135|  21.2k|                                sample_mask += sample_mask;
 2136|  21.2k|                            }
 2137|  28.0k|                            col_mask <<= 4; //next column
 2138|  28.0k|                        }
 2139|  3.51k|                    }
 2140|       |                    // consume data according to the number of bits set
 2141|  4.80k|                    rev_advance_mrp(&magref, population_count(sig));
 2142|  4.80k|                }
 2143|     47|            }
 2144|       |
 2145|     53|            if (y >= 4) { // update mbr array at the end of each stripe
  ------------------
  |  Branch (2145:17): [True: 53, False: 0]
  ------------------
 2146|       |                //generate mbr corresponding to a stripe
 2147|     53|                OPJ_UINT32 *sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2147:35): [True: 53, False: 0]
  ------------------
 2148|     53|                OPJ_UINT32 *mbr = y & 0x4 ? mbr1 : mbr2;
  ------------------
  |  Branch (2148:35): [True: 53, False: 0]
  ------------------
 2149|       |
 2150|       |                //data is processed in patches of 8 columns, each
 2151|       |                // each 32 bits in sigma1 or mbr1 represent 4 rows
 2152|       |
 2153|       |                //integrate horizontally
 2154|     53|                OPJ_UINT32 prev = 0; // previous columns
 2155|     53|                OPJ_INT32 i;
 2156|  5.44k|                for (i = 0; i < width; i += 8, mbr++, sig++) {
  ------------------
  |  Branch (2156:29): [True: 5.39k, False: 53]
  ------------------
 2157|  5.39k|                    OPJ_UINT32 t, z;
 2158|       |
 2159|  5.39k|                    mbr[0] = sig[0];         //start with significant samples
 2160|  5.39k|                    mbr[0] |= prev >> 28;    //for first column, left neighbors
 2161|  5.39k|                    mbr[0] |= sig[0] << 4;   //left neighbors
 2162|  5.39k|                    mbr[0] |= sig[0] >> 4;   //right neighbors
 2163|  5.39k|                    mbr[0] |= sig[1] << 28;  //for last column, right neighbors
 2164|  5.39k|                    prev = sig[0];           // for next group of columns
 2165|       |
 2166|       |                    //integrate vertically
 2167|  5.39k|                    t = mbr[0], z = mbr[0];
 2168|  5.39k|                    z |= (t & 0x77777777) << 1; //above neighbors
 2169|  5.39k|                    z |= (t & 0xEEEEEEEE) >> 1; //below neighbors
 2170|  5.39k|                    mbr[0] = z & ~sig[0]; //remove already significance samples
 2171|  5.39k|                }
 2172|     53|            }
 2173|       |
 2174|     53|            if (y >= 8) { //wait until 8 rows has been processed
  ------------------
  |  Branch (2174:17): [True: 0, False: 53]
  ------------------
 2175|      0|                OPJ_UINT32 *cur_sig, *cur_mbr, *nxt_sig, *nxt_mbr;
 2176|      0|                OPJ_UINT32 prev;
 2177|      0|                OPJ_UINT32 val;
 2178|      0|                OPJ_INT32 i;
 2179|       |
 2180|       |                // add membership from the next stripe, obtained above
 2181|      0|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2181:27): [True: 0, False: 0]
  ------------------
 2182|      0|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2182:27): [True: 0, False: 0]
  ------------------
 2183|      0|                nxt_sig = y & 0x4 ? sigma1 : sigma2;  //future samples
  ------------------
  |  Branch (2183:27): [True: 0, False: 0]
  ------------------
 2184|      0|                prev = 0; // the columns before these group of 8 columns
 2185|      0|                for (i = 0; i < width; i += 8, cur_mbr++, cur_sig++, nxt_sig++) {
  ------------------
  |  Branch (2185:29): [True: 0, False: 0]
  ------------------
 2186|      0|                    OPJ_UINT32 t = nxt_sig[0];
 2187|      0|                    t |= prev >> 28;        //for first column, left neighbors
 2188|      0|                    t |= nxt_sig[0] << 4;   //left neighbors
 2189|      0|                    t |= nxt_sig[0] >> 4;   //right neighbors
 2190|      0|                    t |= nxt_sig[1] << 28;  //for last column, right neighbors
 2191|      0|                    prev = nxt_sig[0];      // for next group of columns
 2192|       |
 2193|      0|                    if (!stripe_causal) {
  ------------------
  |  Branch (2193:25): [True: 0, False: 0]
  ------------------
 2194|      0|                        cur_mbr[0] |= (t & 0x11111111u) << 3; //propagate up to cur_mbr
 2195|      0|                    }
 2196|      0|                    cur_mbr[0] &= ~cur_sig[0]; //remove already significance samples
 2197|      0|                }
 2198|       |
 2199|       |                //find new locations and get signs
 2200|      0|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2200:27): [True: 0, False: 0]
  ------------------
 2201|      0|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2201:27): [True: 0, False: 0]
  ------------------
 2202|      0|                nxt_sig = y & 0x4 ? sigma1 : sigma2; //future samples
  ------------------
  |  Branch (2202:27): [True: 0, False: 0]
  ------------------
 2203|      0|                nxt_mbr = y & 0x4 ? mbr1 : mbr2;     //future samples
  ------------------
  |  Branch (2203:27): [True: 0, False: 0]
  ------------------
 2204|      0|                val = 3u << (p - 2); // sample values for newly discovered
 2205|       |                // significant samples including the bin center
 2206|      0|                for (i = 0; i < width;
  ------------------
  |  Branch (2206:29): [True: 0, False: 0]
  ------------------
 2207|      0|                        i += 8, cur_sig++, cur_mbr++, nxt_sig++, nxt_mbr++) {
 2208|      0|                    OPJ_UINT32 ux, tx;
 2209|      0|                    OPJ_UINT32 mbr = *cur_mbr;
 2210|      0|                    OPJ_UINT32 new_sig = 0;
 2211|      0|                    if (mbr) { //are there any samples that might be significant
  ------------------
  |  Branch (2211:25): [True: 0, False: 0]
  ------------------
 2212|      0|                        OPJ_INT32 n;
 2213|      0|                        for (n = 0; n < 8; n += 4) {
  ------------------
  |  Branch (2213:37): [True: 0, False: 0]
  ------------------
 2214|      0|                            OPJ_UINT32 col_mask;
 2215|      0|                            OPJ_UINT32 inv_sig;
 2216|      0|                            OPJ_INT32 end;
 2217|      0|                            OPJ_INT32 j;
 2218|       |
 2219|      0|                            OPJ_UINT32 cwd = frwd_fetch(&sigprop); //get 32 bits
 2220|      0|                            OPJ_UINT32 cnt = 0;
 2221|       |
 2222|      0|                            OPJ_UINT32 *dp = decoded_data + (y - 8) * stride;
 2223|      0|                            dp += i + n; //address for decoded samples
 2224|       |
 2225|      0|                            col_mask = 0xFu << (4 * n); //a mask to select a column
 2226|       |
 2227|      0|                            inv_sig = ~cur_sig[0]; // insignificant samples
 2228|       |
 2229|       |                            //find the last sample we operate on
 2230|      0|                            end = n + 4 + i < width ? n + 4 : width - i;
  ------------------
  |  Branch (2230:35): [True: 0, False: 0]
  ------------------
 2231|       |
 2232|      0|                            for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2232:41): [True: 0, False: 0]
  ------------------
 2233|      0|                                OPJ_UINT32 sample_mask;
 2234|       |
 2235|      0|                                if ((col_mask & mbr) == 0) { //no samples need checking
  ------------------
  |  Branch (2235:37): [True: 0, False: 0]
  ------------------
 2236|      0|                                    continue;
 2237|      0|                                }
 2238|       |
 2239|       |                                //scan mbr to find a new significant sample
 2240|      0|                                sample_mask = 0x11111111u & col_mask; // LSB
 2241|      0|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2241:37): [True: 0, False: 0]
  ------------------
 2242|      0|                                    assert(dp[0] == 0); // the sample must have been 0
 2243|      0|                                    if (cwd & 1) { //if this sample has become significant
  ------------------
  |  Branch (2243:41): [True: 0, False: 0]
  ------------------
 2244|       |                                        // must propagate it to nearby samples
 2245|      0|                                        OPJ_UINT32 t;
 2246|      0|                                        new_sig |= sample_mask;  // new significant samples
 2247|      0|                                        t = 0x32u << (j * 4);// propagation to neighbors
 2248|      0|                                        mbr |= t & inv_sig; //remove already significant samples
 2249|      0|                                    }
 2250|      0|                                    cwd >>= 1;
 2251|      0|                                    ++cnt; //consume bit and increment number of
 2252|       |                                    //consumed bits
 2253|      0|                                }
 2254|       |
 2255|      0|                                sample_mask += sample_mask;  // next row
 2256|      0|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2256:37): [True: 0, False: 0]
  ------------------
 2257|      0|                                    assert(dp[stride] == 0);
 2258|      0|                                    if (cwd & 1) {
  ------------------
  |  Branch (2258:41): [True: 0, False: 0]
  ------------------
 2259|      0|                                        OPJ_UINT32 t;
 2260|      0|                                        new_sig |= sample_mask;
 2261|      0|                                        t = 0x74u << (j * 4);
 2262|      0|                                        mbr |= t & inv_sig;
 2263|      0|                                    }
 2264|      0|                                    cwd >>= 1;
 2265|      0|                                    ++cnt;
 2266|      0|                                }
 2267|       |
 2268|      0|                                sample_mask += sample_mask;
 2269|      0|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2269:37): [True: 0, False: 0]
  ------------------
 2270|      0|                                    assert(dp[2 * stride] == 0);
 2271|      0|                                    if (cwd & 1) {
  ------------------
  |  Branch (2271:41): [True: 0, False: 0]
  ------------------
 2272|      0|                                        OPJ_UINT32 t;
 2273|      0|                                        new_sig |= sample_mask;
 2274|      0|                                        t = 0xE8u << (j * 4);
 2275|      0|                                        mbr |= t & inv_sig;
 2276|      0|                                    }
 2277|      0|                                    cwd >>= 1;
 2278|      0|                                    ++cnt;
 2279|      0|                                }
 2280|       |
 2281|      0|                                sample_mask += sample_mask;
 2282|      0|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2282:37): [True: 0, False: 0]
  ------------------
 2283|      0|                                    assert(dp[3 * stride] == 0);
 2284|      0|                                    if (cwd & 1) {
  ------------------
  |  Branch (2284:41): [True: 0, False: 0]
  ------------------
 2285|      0|                                        OPJ_UINT32 t;
 2286|      0|                                        new_sig |= sample_mask;
 2287|      0|                                        t = 0xC0u << (j * 4);
 2288|      0|                                        mbr |= t & inv_sig;
 2289|      0|                                    }
 2290|      0|                                    cwd >>= 1;
 2291|      0|                                    ++cnt;
 2292|      0|                                }
 2293|      0|                            }
 2294|       |
 2295|       |                            //obtain signs here
 2296|      0|                            if (new_sig & (0xFFFFu << (4 * n))) { //if any
  ------------------
  |  Branch (2296:33): [True: 0, False: 0]
  ------------------
 2297|      0|                                OPJ_UINT32 col_mask;
 2298|      0|                                OPJ_INT32 j;
 2299|      0|                                OPJ_UINT32 *dp = decoded_data + (y - 8) * stride;
 2300|      0|                                dp += i + n; // decoded samples address
 2301|      0|                                col_mask = 0xFu << (4 * n); //mask to select a column
 2302|       |
 2303|      0|                                for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2303:45): [True: 0, False: 0]
  ------------------
 2304|      0|                                    OPJ_UINT32 sample_mask;
 2305|       |
 2306|      0|                                    if ((col_mask & new_sig) == 0) { //if non is significant
  ------------------
  |  Branch (2306:41): [True: 0, False: 0]
  ------------------
 2307|      0|                                        continue;
 2308|      0|                                    }
 2309|       |
 2310|       |                                    //scan 4 signs
 2311|      0|                                    sample_mask = 0x11111111u & col_mask;
 2312|      0|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2312:41): [True: 0, False: 0]
  ------------------
 2313|      0|                                        assert(dp[0] == 0);
 2314|      0|                                        dp[0] |= ((cwd & 1) << 31) | val; //put value and sign
 2315|      0|                                        cwd >>= 1;
 2316|      0|                                        ++cnt; //consume bit and increment number
 2317|       |                                        //of consumed bits
 2318|      0|                                    }
 2319|       |
 2320|      0|                                    sample_mask += sample_mask;
 2321|      0|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2321:41): [True: 0, False: 0]
  ------------------
 2322|      0|                                        assert(dp[stride] == 0);
 2323|      0|                                        dp[stride] |= ((cwd & 1) << 31) | val;
 2324|      0|                                        cwd >>= 1;
 2325|      0|                                        ++cnt;
 2326|      0|                                    }
 2327|       |
 2328|      0|                                    sample_mask += sample_mask;
 2329|      0|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2329:41): [True: 0, False: 0]
  ------------------
 2330|      0|                                        assert(dp[2 * stride] == 0);
 2331|      0|                                        dp[2 * stride] |= ((cwd & 1) << 31) | val;
 2332|      0|                                        cwd >>= 1;
 2333|      0|                                        ++cnt;
 2334|      0|                                    }
 2335|       |
 2336|      0|                                    sample_mask += sample_mask;
 2337|      0|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2337:41): [True: 0, False: 0]
  ------------------
 2338|      0|                                        assert(dp[3 * stride] == 0);
 2339|      0|                                        dp[3 * stride] |= ((cwd & 1) << 31) | val;
 2340|      0|                                        cwd >>= 1;
 2341|      0|                                        ++cnt;
 2342|      0|                                    }
 2343|      0|                                }
 2344|       |
 2345|      0|                            }
 2346|      0|                            frwd_advance(&sigprop, cnt); //consume the bits from bitstrm
 2347|      0|                            cnt = 0;
 2348|       |
 2349|       |                            //update the next 8 columns
 2350|      0|                            if (n == 4) {
  ------------------
  |  Branch (2350:33): [True: 0, False: 0]
  ------------------
 2351|       |                                //horizontally
 2352|      0|                                OPJ_UINT32 t = new_sig >> 28;
 2353|      0|                                t |= ((t & 0xE) >> 1) | ((t & 7) << 1);
 2354|      0|                                cur_mbr[1] |= t & ~cur_sig[1];
 2355|      0|                            }
 2356|      0|                        }
 2357|      0|                    }
 2358|       |                    //update the next stripe (vertically propagation)
 2359|      0|                    new_sig |= cur_sig[0];
 2360|      0|                    ux = (new_sig & 0x88888888) >> 3;
 2361|      0|                    tx = ux | (ux << 4) | (ux >> 4); //left and right neighbors
 2362|      0|                    if (i > 0) {
  ------------------
  |  Branch (2362:25): [True: 0, False: 0]
  ------------------
 2363|      0|                        nxt_mbr[-1] |= (ux << 28) & ~nxt_sig[-1];
 2364|      0|                    }
 2365|      0|                    nxt_mbr[0] |= tx & ~nxt_sig[0];
 2366|      0|                    nxt_mbr[1] |= (ux >> 28) & ~nxt_sig[1];
 2367|      0|                }
 2368|       |
 2369|       |                //clear current sigma
 2370|       |                //mbr need not be cleared because it is overwritten
 2371|      0|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2371:27): [True: 0, False: 0]
  ------------------
 2372|      0|                memset(cur_sig, 0, ((((OPJ_UINT32)width + 7u) >> 3) + 1u) << 2);
 2373|      0|            }
 2374|     53|        }
 2375|    400|    }
 2376|       |
 2377|       |    //terminating
 2378|     83|    if (num_passes > 1) {
  ------------------
  |  Branch (2378:9): [True: 68, False: 15]
  ------------------
 2379|     68|        OPJ_INT32 st, y;
 2380|       |
 2381|     68|        if (num_passes > 2 && ((height & 3) == 1 || (height & 3) == 2)) {
  ------------------
  |  Branch (2381:13): [True: 62, False: 6]
  |  Branch (2381:32): [True: 2, False: 60]
  |  Branch (2381:53): [True: 13, False: 47]
  ------------------
 2382|       |            //do magref
 2383|     15|            OPJ_UINT32 *cur_sig = height & 0x4 ? sigma2 : sigma1; //reversed
  ------------------
  |  Branch (2383:35): [True: 0, False: 15]
  ------------------
 2384|     15|            OPJ_UINT32 *dpp = decoded_data + (height & 0xFFFFFC) * stride;
 2385|     15|            OPJ_UINT32 half = 1u << (p - 2);
 2386|     15|            OPJ_INT32 i;
 2387|    756|            for (i = 0; i < width; i += 8) {
  ------------------
  |  Branch (2387:25): [True: 741, False: 15]
  ------------------
 2388|    741|                OPJ_UINT32 cwd = rev_fetch_mrp(&magref);
 2389|    741|                OPJ_UINT32 sig = *cur_sig++;
 2390|    741|                OPJ_UINT32 col_mask = 0xF;
 2391|    741|                OPJ_UINT32 *dp = dpp + i;
 2392|    741|                if (sig) {
  ------------------
  |  Branch (2392:21): [True: 426, False: 315]
  ------------------
 2393|    426|                    int j;
 2394|  3.83k|                    for (j = 0; j < 8; ++j, dp++) {
  ------------------
  |  Branch (2394:33): [True: 3.40k, False: 426]
  ------------------
 2395|  3.40k|                        if (sig & col_mask) {
  ------------------
  |  Branch (2395:29): [True: 885, False: 2.52k]
  ------------------
 2396|    885|                            OPJ_UINT32 sample_mask = 0x11111111 & col_mask;
 2397|       |
 2398|    885|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2398:33): [True: 15, False: 870]
  ------------------
 2399|     15|                                OPJ_UINT32 sym;
 2400|     15|                                assert(dp[0] != 0);
 2401|     15|                                sym = cwd & 1;
 2402|     15|                                dp[0] ^= (1 - sym) << (p - 1);
 2403|     15|                                dp[0] |= half;
 2404|     15|                                cwd >>= 1;
 2405|     15|                            }
 2406|    885|                            sample_mask += sample_mask;
 2407|       |
 2408|    885|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2408:33): [True: 882, False: 3]
  ------------------
 2409|    882|                                OPJ_UINT32 sym;
 2410|    882|                                assert(dp[stride] != 0);
 2411|    882|                                sym = cwd & 1;
 2412|    882|                                dp[stride] ^= (1 - sym) << (p - 1);
 2413|    882|                                dp[stride] |= half;
 2414|    882|                                cwd >>= 1;
 2415|    882|                            }
 2416|    885|                            sample_mask += sample_mask;
 2417|       |
 2418|    885|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2418:33): [True: 0, False: 885]
  ------------------
 2419|      0|                                OPJ_UINT32 sym;
 2420|      0|                                assert(dp[2 * stride] != 0);
 2421|      0|                                sym = cwd & 1;
 2422|      0|                                dp[2 * stride] ^= (1 - sym) << (p - 1);
 2423|      0|                                dp[2 * stride] |= half;
 2424|      0|                                cwd >>= 1;
 2425|      0|                            }
 2426|    885|                            sample_mask += sample_mask;
 2427|       |
 2428|    885|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2428:33): [True: 0, False: 885]
  ------------------
 2429|      0|                                OPJ_UINT32 sym;
 2430|      0|                                assert(dp[3 * stride] != 0);
 2431|      0|                                sym = cwd & 1;
 2432|      0|                                dp[3 * stride] ^= (1 - sym) << (p - 1);
 2433|      0|                                dp[3 * stride] |= half;
 2434|      0|                                cwd >>= 1;
 2435|      0|                            }
 2436|    885|                            sample_mask += sample_mask;
 2437|    885|                        }
 2438|  3.40k|                        col_mask <<= 4;
 2439|  3.40k|                    }
 2440|    426|                }
 2441|    741|                rev_advance_mrp(&magref, population_count(sig));
 2442|    741|            }
 2443|     15|        }
 2444|       |
 2445|       |        //do the last incomplete stripe
 2446|       |        // for cases of (height & 3) == 0 and 3
 2447|       |        // the should have been processed previously
 2448|     68|        if ((height & 3) == 1 || (height & 3) == 2) {
  ------------------
  |  Branch (2448:13): [True: 2, False: 66]
  |  Branch (2448:34): [True: 13, False: 53]
  ------------------
 2449|       |            //generate mbr of first stripe
 2450|     15|            OPJ_UINT32 *sig = height & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2450:31): [True: 0, False: 15]
  ------------------
 2451|     15|            OPJ_UINT32 *mbr = height & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2451:31): [True: 0, False: 15]
  ------------------
 2452|       |            //integrate horizontally
 2453|     15|            OPJ_UINT32 prev = 0;
 2454|     15|            OPJ_INT32 i;
 2455|    756|            for (i = 0; i < width; i += 8, mbr++, sig++) {
  ------------------
  |  Branch (2455:25): [True: 741, False: 15]
  ------------------
 2456|    741|                OPJ_UINT32 t, z;
 2457|       |
 2458|    741|                mbr[0] = sig[0];
 2459|    741|                mbr[0] |= prev >> 28;    //for first column, left neighbors
 2460|    741|                mbr[0] |= sig[0] << 4;   //left neighbors
 2461|    741|                mbr[0] |= sig[0] >> 4;   //left neighbors
 2462|    741|                mbr[0] |= sig[1] << 28;  //for last column, right neighbors
 2463|    741|                prev = sig[0];
 2464|       |
 2465|       |                //integrate vertically
 2466|    741|                t = mbr[0], z = mbr[0];
 2467|    741|                z |= (t & 0x77777777) << 1; //above neighbors
 2468|    741|                z |= (t & 0xEEEEEEEE) >> 1; //below neighbors
 2469|    741|                mbr[0] = z & ~sig[0]; //remove already significance samples
 2470|    741|            }
 2471|     15|        }
 2472|       |
 2473|     68|        st = height;
 2474|     68|        st -= height > 6 ? (((height + 1) & 3) + 3) : height;
  ------------------
  |  Branch (2474:15): [True: 0, False: 68]
  ------------------
 2475|    136|        for (y = st; y < height; y += 4) {
  ------------------
  |  Branch (2475:22): [True: 68, False: 68]
  ------------------
 2476|     68|            OPJ_UINT32 *cur_sig, *cur_mbr, *nxt_sig, *nxt_mbr;
 2477|     68|            OPJ_UINT32 val;
 2478|     68|            OPJ_INT32 i;
 2479|       |
 2480|     68|            OPJ_UINT32 pattern = 0xFFFFFFFFu; // a pattern needed samples
 2481|     68|            if (height - y == 3) {
  ------------------
  |  Branch (2481:17): [True: 0, False: 68]
  ------------------
 2482|      0|                pattern = 0x77777777u;
 2483|     68|            } else if (height - y == 2) {
  ------------------
  |  Branch (2483:24): [True: 13, False: 55]
  ------------------
 2484|     13|                pattern = 0x33333333u;
 2485|     55|            } else if (height - y == 1) {
  ------------------
  |  Branch (2485:24): [True: 2, False: 53]
  ------------------
 2486|      2|                pattern = 0x11111111u;
 2487|      2|            }
 2488|       |
 2489|       |            //add membership from the next stripe, obtained above
 2490|     68|            if (height - y > 4) {
  ------------------
  |  Branch (2490:17): [True: 0, False: 68]
  ------------------
 2491|      0|                OPJ_UINT32 prev = 0;
 2492|      0|                OPJ_INT32 i;
 2493|      0|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2493:27): [True: 0, False: 0]
  ------------------
 2494|      0|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2494:27): [True: 0, False: 0]
  ------------------
 2495|      0|                nxt_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2495:27): [True: 0, False: 0]
  ------------------
 2496|      0|                for (i = 0; i < width; i += 8, cur_mbr++, cur_sig++, nxt_sig++) {
  ------------------
  |  Branch (2496:29): [True: 0, False: 0]
  ------------------
 2497|      0|                    OPJ_UINT32 t = nxt_sig[0];
 2498|      0|                    t |= prev >> 28;     //for first column, left neighbors
 2499|      0|                    t |= nxt_sig[0] << 4;   //left neighbors
 2500|      0|                    t |= nxt_sig[0] >> 4;   //left neighbors
 2501|      0|                    t |= nxt_sig[1] << 28;  //for last column, right neighbors
 2502|      0|                    prev = nxt_sig[0];
 2503|       |
 2504|      0|                    if (!stripe_causal) {
  ------------------
  |  Branch (2504:25): [True: 0, False: 0]
  ------------------
 2505|      0|                        cur_mbr[0] |= (t & 0x11111111u) << 3;
 2506|      0|                    }
 2507|       |                    //remove already significance samples
 2508|      0|                    cur_mbr[0] &= ~cur_sig[0];
 2509|      0|                }
 2510|      0|            }
 2511|       |
 2512|       |            //find new locations and get signs
 2513|     68|            cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2513:23): [True: 0, False: 68]
  ------------------
 2514|     68|            cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2514:23): [True: 0, False: 68]
  ------------------
 2515|     68|            nxt_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2515:23): [True: 0, False: 68]
  ------------------
 2516|     68|            nxt_mbr = y & 0x4 ? mbr1 : mbr2;
  ------------------
  |  Branch (2516:23): [True: 0, False: 68]
  ------------------
 2517|     68|            val = 3u << (p - 2);
 2518|  6.20k|            for (i = 0; i < width; i += 8,
  ------------------
  |  Branch (2518:25): [True: 6.13k, False: 68]
  ------------------
 2519|  6.13k|                    cur_sig++, cur_mbr++, nxt_sig++, nxt_mbr++) {
 2520|  6.13k|                OPJ_UINT32 mbr = *cur_mbr & pattern; //skip unneeded samples
 2521|  6.13k|                OPJ_UINT32 new_sig = 0;
 2522|  6.13k|                OPJ_UINT32 ux, tx;
 2523|  6.13k|                if (mbr) {
  ------------------
  |  Branch (2523:21): [True: 4.53k, False: 1.59k]
  ------------------
 2524|  4.53k|                    OPJ_INT32 n;
 2525|  13.6k|                    for (n = 0; n < 8; n += 4) {
  ------------------
  |  Branch (2525:33): [True: 9.07k, False: 4.53k]
  ------------------
 2526|  9.07k|                        OPJ_UINT32 col_mask;
 2527|  9.07k|                        OPJ_UINT32 inv_sig;
 2528|  9.07k|                        OPJ_INT32 end;
 2529|  9.07k|                        OPJ_INT32 j;
 2530|       |
 2531|  9.07k|                        OPJ_UINT32 cwd = frwd_fetch(&sigprop);
 2532|  9.07k|                        OPJ_UINT32 cnt = 0;
 2533|       |
 2534|  9.07k|                        OPJ_UINT32 *dp = decoded_data + y * stride;
 2535|  9.07k|                        dp += i + n;
 2536|       |
 2537|  9.07k|                        col_mask = 0xFu << (4 * n);
 2538|       |
 2539|  9.07k|                        inv_sig = ~cur_sig[0] & pattern;
 2540|       |
 2541|  9.07k|                        end = n + 4 + i < width ? n + 4 : width - i;
  ------------------
  |  Branch (2541:31): [True: 9.03k, False: 45]
  ------------------
 2542|  45.3k|                        for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2542:37): [True: 36.2k, False: 9.07k]
  ------------------
 2543|  36.2k|                            OPJ_UINT32 sample_mask;
 2544|       |
 2545|  36.2k|                            if ((col_mask & mbr) == 0) {
  ------------------
  |  Branch (2545:33): [True: 5.43k, False: 30.7k]
  ------------------
 2546|  5.43k|                                continue;
 2547|  5.43k|                            }
 2548|       |
 2549|       |                            //scan 4 mbr
 2550|  30.7k|                            sample_mask = 0x11111111u & col_mask;
 2551|  30.7k|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2551:33): [True: 14.8k, False: 15.9k]
  ------------------
 2552|  14.8k|                                assert(dp[0] == 0);
 2553|  14.8k|                                if (cwd & 1) {
  ------------------
  |  Branch (2553:37): [True: 5.92k, False: 8.93k]
  ------------------
 2554|  5.92k|                                    OPJ_UINT32 t;
 2555|  5.92k|                                    new_sig |= sample_mask;
 2556|  5.92k|                                    t = 0x32u << (j * 4);
 2557|  5.92k|                                    mbr |= t & inv_sig;
 2558|  5.92k|                                }
 2559|  14.8k|                                cwd >>= 1;
 2560|  14.8k|                                ++cnt;
 2561|  14.8k|                            }
 2562|       |
 2563|  30.7k|                            sample_mask += sample_mask;
 2564|  30.7k|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2564:33): [True: 13.9k, False: 16.8k]
  ------------------
 2565|  13.9k|                                assert(dp[stride] == 0);
 2566|  13.9k|                                if (cwd & 1) {
  ------------------
  |  Branch (2566:37): [True: 5.79k, False: 8.12k]
  ------------------
 2567|  5.79k|                                    OPJ_UINT32 t;
 2568|  5.79k|                                    new_sig |= sample_mask;
 2569|  5.79k|                                    t = 0x74u << (j * 4);
 2570|  5.79k|                                    mbr |= t & inv_sig;
 2571|  5.79k|                                }
 2572|  13.9k|                                cwd >>= 1;
 2573|  13.9k|                                ++cnt;
 2574|  13.9k|                            }
 2575|       |
 2576|  30.7k|                            sample_mask += sample_mask;
 2577|  30.7k|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2577:33): [True: 24.2k, False: 6.57k]
  ------------------
 2578|  24.2k|                                assert(dp[2 * stride] == 0);
 2579|  24.2k|                                if (cwd & 1) {
  ------------------
  |  Branch (2579:37): [True: 8.68k, False: 15.5k]
  ------------------
 2580|  8.68k|                                    OPJ_UINT32 t;
 2581|  8.68k|                                    new_sig |= sample_mask;
 2582|  8.68k|                                    t = 0xE8u << (j * 4);
 2583|  8.68k|                                    mbr |= t & inv_sig;
 2584|  8.68k|                                }
 2585|  24.2k|                                cwd >>= 1;
 2586|  24.2k|                                ++cnt;
 2587|  24.2k|                            }
 2588|       |
 2589|  30.7k|                            sample_mask += sample_mask;
 2590|  30.7k|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2590:33): [True: 14.3k, False: 16.4k]
  ------------------
 2591|  14.3k|                                assert(dp[3 * stride] == 0);
 2592|  14.3k|                                if (cwd & 1) {
  ------------------
  |  Branch (2592:37): [True: 8.69k, False: 5.64k]
  ------------------
 2593|  8.69k|                                    OPJ_UINT32 t;
 2594|  8.69k|                                    new_sig |= sample_mask;
 2595|  8.69k|                                    t = 0xC0u << (j * 4);
 2596|  8.69k|                                    mbr |= t & inv_sig;
 2597|  8.69k|                                }
 2598|  14.3k|                                cwd >>= 1;
 2599|  14.3k|                                ++cnt;
 2600|  14.3k|                            }
 2601|  30.7k|                        }
 2602|       |
 2603|       |                        //signs here
 2604|  9.07k|                        if (new_sig & (0xFFFFu << (4 * n))) {
  ------------------
  |  Branch (2604:29): [True: 5.05k, False: 4.02k]
  ------------------
 2605|  5.05k|                            OPJ_UINT32 col_mask;
 2606|  5.05k|                            OPJ_INT32 j;
 2607|  5.05k|                            OPJ_UINT32 *dp = decoded_data + y * stride;
 2608|  5.05k|                            dp += i + n;
 2609|  5.05k|                            col_mask = 0xFu << (4 * n);
 2610|       |
 2611|  25.2k|                            for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2611:41): [True: 20.2k, False: 5.05k]
  ------------------
 2612|  20.2k|                                OPJ_UINT32 sample_mask;
 2613|  20.2k|                                if ((col_mask & new_sig) == 0) {
  ------------------
  |  Branch (2613:37): [True: 6.57k, False: 13.6k]
  ------------------
 2614|  6.57k|                                    continue;
 2615|  6.57k|                                }
 2616|       |
 2617|       |                                //scan 4 signs
 2618|  13.6k|                                sample_mask = 0x11111111u & col_mask;
 2619|  13.6k|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2619:37): [True: 5.92k, False: 7.70k]
  ------------------
 2620|  5.92k|                                    assert(dp[0] == 0);
 2621|  5.92k|                                    dp[0] |= ((cwd & 1) << 31) | val;
 2622|  5.92k|                                    cwd >>= 1;
 2623|  5.92k|                                    ++cnt;
 2624|  5.92k|                                }
 2625|       |
 2626|  13.6k|                                sample_mask += sample_mask;
 2627|  13.6k|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2627:37): [True: 5.79k, False: 7.82k]
  ------------------
 2628|  5.79k|                                    assert(dp[stride] == 0);
 2629|  5.79k|                                    dp[stride] |= ((cwd & 1) << 31) | val;
 2630|  5.79k|                                    cwd >>= 1;
 2631|  5.79k|                                    ++cnt;
 2632|  5.79k|                                }
 2633|       |
 2634|  13.6k|                                sample_mask += sample_mask;
 2635|  13.6k|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2635:37): [True: 8.68k, False: 4.94k]
  ------------------
 2636|  8.68k|                                    assert(dp[2 * stride] == 0);
 2637|  8.68k|                                    dp[2 * stride] |= ((cwd & 1) << 31) | val;
 2638|  8.68k|                                    cwd >>= 1;
 2639|  8.68k|                                    ++cnt;
 2640|  8.68k|                                }
 2641|       |
 2642|  13.6k|                                sample_mask += sample_mask;
 2643|  13.6k|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2643:37): [True: 8.69k, False: 4.92k]
  ------------------
 2644|  8.69k|                                    assert(dp[3 * stride] == 0);
 2645|  8.69k|                                    dp[3 * stride] |= ((cwd & 1) << 31) | val;
 2646|  8.69k|                                    cwd >>= 1;
 2647|  8.69k|                                    ++cnt;
 2648|  8.69k|                                }
 2649|  13.6k|                            }
 2650|       |
 2651|  5.05k|                        }
 2652|  9.07k|                        frwd_advance(&sigprop, cnt);
 2653|  9.07k|                        cnt = 0;
 2654|       |
 2655|       |                        //update next columns
 2656|  9.07k|                        if (n == 4) {
  ------------------
  |  Branch (2656:29): [True: 4.53k, False: 4.53k]
  ------------------
 2657|       |                            //horizontally
 2658|  4.53k|                            OPJ_UINT32 t = new_sig >> 28;
 2659|  4.53k|                            t |= ((t & 0xE) >> 1) | ((t & 7) << 1);
 2660|  4.53k|                            cur_mbr[1] |= t & ~cur_sig[1];
 2661|  4.53k|                        }
 2662|  9.07k|                    }
 2663|  4.53k|                }
 2664|       |                //propagate down (vertically propagation)
 2665|  6.13k|                new_sig |= cur_sig[0];
 2666|  6.13k|                ux = (new_sig & 0x88888888) >> 3;
 2667|  6.13k|                tx = ux | (ux << 4) | (ux >> 4);
 2668|  6.13k|                if (i > 0) {
  ------------------
  |  Branch (2668:21): [True: 6.06k, False: 68]
  ------------------
 2669|  6.06k|                    nxt_mbr[-1] |= (ux << 28) & ~nxt_sig[-1];
 2670|  6.06k|                }
 2671|  6.13k|                nxt_mbr[0] |= tx & ~nxt_sig[0];
 2672|  6.13k|                nxt_mbr[1] |= (ux >> 28) & ~nxt_sig[1];
 2673|  6.13k|            }
 2674|     68|        }
 2675|     68|    }
 2676|       |
 2677|     83|    {
 2678|     83|        OPJ_INT32 x, y;
 2679|    839|        for (y = 0; y < height; ++y) {
  ------------------
  |  Branch (2679:21): [True: 756, False: 83]
  ------------------
 2680|    756|            OPJ_INT32* sp = (OPJ_INT32*)decoded_data + y * stride;
 2681|   205k|            for (x = 0; x < width; ++x, ++sp) {
  ------------------
  |  Branch (2681:25): [True: 204k, False: 756]
  ------------------
 2682|   204k|                OPJ_INT32 val = (*sp & 0x7FFFFFFF);
 2683|   204k|                *sp = ((OPJ_UINT32) * sp & 0x80000000) ? -val : val;
  ------------------
  |  Branch (2683:23): [True: 61.4k, False: 143k]
  ------------------
 2684|   204k|            }
 2685|    756|        }
 2686|     83|    }
 2687|       |
 2688|     83|    return OPJ_TRUE;
  ------------------
  |  |  117|     83|#define OPJ_TRUE 1
  ------------------
 2689|    103|}
ht_dec.c:opj_t1_allocate_buffers:
 1043|  60.2k|{
 1044|  60.2k|    OPJ_UINT32 flagssize;
 1045|       |
 1046|       |    /* No risk of overflow. Prior checks ensure those assert are met */
 1047|       |    /* They are per the specification */
 1048|  60.2k|    assert(w <= 1024);
 1049|  60.2k|    assert(h <= 1024);
 1050|  60.2k|    assert(w * h <= 4096);
 1051|       |
 1052|       |    /* encoder uses tile buffer, so no need to allocate */
 1053|  60.2k|    {
 1054|  60.2k|        OPJ_UINT32 datasize = w * h;
 1055|       |
 1056|  60.2k|        if (datasize > t1->datasize) {
  ------------------
  |  Branch (1056:13): [True: 308, False: 59.9k]
  ------------------
 1057|    308|            opj_aligned_free(t1->data);
 1058|    308|            t1->data = (OPJ_INT32*)
 1059|    308|                       opj_aligned_malloc(datasize * sizeof(OPJ_INT32));
 1060|    308|            if (!t1->data) {
  ------------------
  |  Branch (1060:17): [True: 0, False: 308]
  ------------------
 1061|       |                /* FIXME event manager error callback */
 1062|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1063|      0|            }
 1064|    308|            t1->datasize = datasize;
 1065|    308|        }
 1066|       |        /* memset first arg is declared to never be null by gcc */
 1067|  60.2k|        if (t1->data != NULL) {
  ------------------
  |  Branch (1067:13): [True: 60.0k, False: 194]
  ------------------
 1068|  60.0k|            memset(t1->data, 0, datasize * sizeof(OPJ_INT32));
 1069|  60.0k|        }
 1070|  60.2k|    }
 1071|       |
 1072|       |    // We expand these buffers to multiples of 16 bytes.
 1073|       |    // We need 4 buffers of 129 integers each, expanded to 132 integers each
 1074|       |    // We also need 514 bytes of buffer, expanded to 528 bytes
 1075|      0|    flagssize = 132U * sizeof(OPJ_UINT32) * 4U; // expanded to multiple of 16
 1076|  60.2k|    flagssize += 528U; // 514 expanded to multiples of 16
 1077|       |
 1078|  60.2k|    {
 1079|  60.2k|        if (flagssize > t1->flagssize) {
  ------------------
  |  Branch (1079:13): [True: 157, False: 60.0k]
  ------------------
 1080|       |
 1081|    157|            opj_aligned_free(t1->flags);
 1082|    157|            t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof(opj_flag_t));
 1083|    157|            if (!t1->flags) {
  ------------------
  |  Branch (1083:17): [True: 0, False: 157]
  ------------------
 1084|       |                /* FIXME event manager error callback */
 1085|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1086|      0|            }
 1087|    157|        }
 1088|  60.2k|        t1->flagssize = flagssize;
 1089|       |
 1090|  60.2k|        memset(t1->flags, 0, flagssize * sizeof(opj_flag_t));
 1091|  60.2k|    }
 1092|       |
 1093|      0|    t1->w = w;
 1094|  60.2k|    t1->h = h;
 1095|       |
 1096|  60.2k|    return OPJ_TRUE;
  ------------------
  |  |  117|  60.2k|#define OPJ_TRUE 1
  ------------------
 1097|  60.2k|}
ht_dec.c:mel_init:
  311|    122|{
  312|    122|    int num;
  313|    122|    int i;
  314|       |
  315|    122|    melp->data = bbuf + lcup - scup; // move the pointer to the start of MEL
  316|    122|    melp->bits = 0;                  // 0 bits in tmp
  317|    122|    melp->tmp = 0;                   //
  318|    122|    melp->unstuff = OPJ_FALSE;       // no unstuffing
  ------------------
  |  |  118|    122|#define OPJ_FALSE 0
  ------------------
  319|    122|    melp->size = scup - 1;           // size is the length of MEL+VLC-1
  320|    122|    melp->k = 0;                     // 0 for state
  321|    122|    melp->num_runs = 0;              // num_runs is 0
  322|    122|    melp->runs = 0;                  //
  323|       |
  324|       |    //This code is borrowed; original is for a different architecture
  325|       |    //These few lines take care of the case where data is not at a multiple
  326|       |    // of 4 boundary.  It reads 1,2,3 up to 4 bytes from the MEL segment
  327|    122|    num = 4 - (int)((intptr_t)(melp->data) & 0x3);
  328|    432|    for (i = 0; i < num; ++i) { // this code is similar to mel_read
  ------------------
  |  Branch (328:17): [True: 311, False: 121]
  ------------------
  329|    311|        OPJ_UINT64 d;
  330|    311|        int d_bits;
  331|       |
  332|    311|        if (melp->unstuff == OPJ_TRUE && melp->data[0] > 0x8F) {
  ------------------
  |  |  117|    622|#define OPJ_TRUE 1
  ------------------
  |  Branch (332:13): [True: 16, False: 295]
  |  Branch (332:42): [True: 1, False: 15]
  ------------------
  333|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
  334|      1|        }
  335|    310|        d = (melp->size > 0) ? *melp->data : 0xFF; // if buffer is consumed
  ------------------
  |  Branch (335:13): [True: 296, False: 14]
  ------------------
  336|       |        // set data to 0xFF
  337|    310|        if (melp->size == 1) {
  ------------------
  |  Branch (337:13): [True: 11, False: 299]
  ------------------
  338|     11|            d |= 0xF;    //if this is MEL+VLC-1, set LSBs to 0xF
  339|     11|        }
  340|       |        // see the standard
  341|    310|        melp->data += melp->size-- > 0; //increment if the end is not reached
  342|    310|        d_bits = 8 - melp->unstuff; //if unstuffing is needed, reduce by 1
  343|    310|        melp->tmp = (melp->tmp << d_bits) | d; //store bits in tmp
  344|    310|        melp->bits += d_bits;  //increment tmp by number of bits
  345|    310|        melp->unstuff = ((d & 0xFF) == 0xFF); //true of next byte needs
  346|       |        //unstuffing
  347|    310|    }
  348|    121|    melp->tmp <<= (64 - melp->bits); //push all the way up so the first bit
  349|       |    // is the MSB
  350|    121|    return OPJ_TRUE;
  ------------------
  |  |  117|    121|#define OPJ_TRUE 1
  ------------------
  351|    122|}
ht_dec.c:rev_init:
  477|    121|{
  478|    121|    OPJ_UINT32 d;
  479|    121|    int num, tnum, i;
  480|       |
  481|       |    //first byte has only the upper 4 bits
  482|    121|    vlcp->data = data + lcup - 2;
  483|       |
  484|       |    //size can not be larger than this, in fact it should be smaller
  485|    121|    vlcp->size = scup - 2;
  486|       |
  487|    121|    d = *vlcp->data--;            // read one byte (this is a half byte)
  488|    121|    vlcp->tmp = d >> 4;           // both initialize and set
  489|    121|    vlcp->bits = 4 - ((vlcp->tmp & 7) == 7); //check standard
  490|    121|    vlcp->unstuff = (d | 0xF) > 0x8F; //this is useful for the next byte
  491|       |
  492|       |    //This code is designed for an architecture that read address should
  493|       |    // align to the read size (address multiple of 4 if read size is 4)
  494|       |    //These few lines take care of the case where data is not at a multiple
  495|       |    // of 4 boundary. It reads 1,2,3 up to 4 bytes from the VLC bitstream.
  496|       |    // To read 32 bits, read from (vlcp->data - 3)
  497|    121|    num = 1 + (int)((intptr_t)(vlcp->data) & 0x3);
  498|    121|    tnum = num < vlcp->size ? num : vlcp->size;
  ------------------
  |  Branch (498:12): [True: 104, False: 17]
  ------------------
  499|    315|    for (i = 0; i < tnum; ++i) {
  ------------------
  |  Branch (499:17): [True: 194, False: 121]
  ------------------
  500|    194|        OPJ_UINT64 d;
  501|    194|        OPJ_UINT32 d_bits;
  502|    194|        d = *vlcp->data--;  // read one byte and move read pointer
  503|       |        //check if the last byte was >0x8F (unstuff == true) and this is 0x7F
  504|    194|        d_bits = 8u - ((vlcp->unstuff && ((d & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (504:25): [True: 28, False: 166]
  |  Branch (504:42): [True: 10, False: 18]
  ------------------
  505|    194|        vlcp->tmp |= d << vlcp->bits; // move data to vlcp->tmp
  506|    194|        vlcp->bits += d_bits;
  507|    194|        vlcp->unstuff = d > 0x8F; // for next byte
  508|    194|    }
  509|    121|    vlcp->size -= tnum;
  510|    121|    rev_read(vlcp);  // read another 32 buts
  511|    121|}
ht_dec.c:rev_read:
  409|  5.81k|{
  410|  5.81k|    OPJ_UINT32 val;
  411|  5.81k|    OPJ_UINT32 tmp;
  412|  5.81k|    OPJ_UINT32 bits;
  413|  5.81k|    OPJ_BOOL unstuff;
  414|       |
  415|       |    //process 4 bytes at a time
  416|  5.81k|    if (vlcp->bits > 32) { // if there are more than 32 bits in tmp, then
  ------------------
  |  Branch (416:9): [True: 16, False: 5.79k]
  ------------------
  417|     16|        return;    // reading 32 bits can overflow vlcp->tmp
  418|     16|    }
  419|  5.79k|    val = 0;
  420|       |    //the next line (the if statement) needs to be tested first
  421|  5.79k|    if (vlcp->size > 3) { // if there are more than 3 bytes left in VLC
  ------------------
  |  Branch (421:9): [True: 3.48k, False: 2.31k]
  ------------------
  422|       |        // (vlcp->data - 3) move pointer back to read 32 bits at once
  423|  3.48k|        val = read_le_uint32(vlcp->data - 3); // then read 32 bits
  424|  3.48k|        vlcp->data -= 4;                // move data pointer back by 4
  425|  3.48k|        vlcp->size -= 4;                // reduce available byte by 4
  426|  3.48k|    } else if (vlcp->size > 0) { // 4 or less
  ------------------
  |  Branch (426:16): [True: 57, False: 2.25k]
  ------------------
  427|     57|        int i = 24;
  428|    180|        while (vlcp->size > 0) {
  ------------------
  |  Branch (428:16): [True: 123, False: 57]
  ------------------
  429|    123|            OPJ_UINT32 v = *vlcp->data--; // read one byte at a time
  430|    123|            val |= (v << i);              // put byte in its correct location
  431|    123|            --vlcp->size;
  432|    123|            i -= 8;
  433|    123|        }
  434|     57|    }
  435|       |
  436|       |    //accumulate in tmp, number of bits in tmp are stored in bits
  437|  5.79k|    tmp = val >> 24;  //start with the MSB byte
  438|       |
  439|       |    // test unstuff (previous byte is >0x8F), and this byte is 0x7F
  440|  5.79k|    bits = 8u - ((vlcp->unstuff && (((val >> 24) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (440:19): [True: 1.11k, False: 4.68k]
  |  Branch (440:36): [True: 22, False: 1.09k]
  ------------------
  441|  5.79k|    unstuff = (val >> 24) > 0x8F; //this is for the next byte
  442|       |
  443|  5.79k|    tmp |= ((val >> 16) & 0xFF) << bits; //process the next byte
  444|  5.79k|    bits += 8u - ((unstuff && (((val >> 16) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (444:20): [True: 1.13k, False: 4.66k]
  |  Branch (444:31): [True: 19, False: 1.11k]
  ------------------
  445|  5.79k|    unstuff = ((val >> 16) & 0xFF) > 0x8F;
  446|       |
  447|  5.79k|    tmp |= ((val >> 8) & 0xFF) << bits;
  448|  5.79k|    bits += 8u - ((unstuff && (((val >> 8) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (448:20): [True: 1.10k, False: 4.69k]
  |  Branch (448:31): [True: 22, False: 1.08k]
  ------------------
  449|  5.79k|    unstuff = ((val >> 8) & 0xFF) > 0x8F;
  450|       |
  451|  5.79k|    tmp |= (val & 0xFF) << bits;
  452|  5.79k|    bits += 8u - ((unstuff && ((val & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (452:20): [True: 1.13k, False: 4.66k]
  |  Branch (452:31): [True: 14, False: 1.12k]
  ------------------
  453|  5.79k|    unstuff = (val & 0xFF) > 0x8F;
  454|       |
  455|       |    // now move the read and unstuffed bits into vlcp->tmp
  456|  5.79k|    vlcp->tmp |= (OPJ_UINT64)tmp << vlcp->bits;
  457|  5.79k|    vlcp->bits += bits;
  458|  5.79k|    vlcp->unstuff = unstuff; // this for the next read
  459|  5.79k|}
ht_dec.c:read_le_uint32:
  132|  10.4k|{
  133|       |#if defined(OPJ_BIG_ENDIAN)
  134|       |    const OPJ_UINT8* data = (const OPJ_UINT8*)dataIn;
  135|       |    return ((OPJ_UINT32)data[0]) | (OPJ_UINT32)(data[1] << 8) | (OPJ_UINT32)(
  136|       |               data[2] << 16) | (((
  137|       |                                      OPJ_UINT32)data[3]) <<
  138|       |                                 24U);
  139|       |#else
  140|  10.4k|    return *(OPJ_UINT32*)dataIn;
  141|  10.4k|#endif
  142|  10.4k|}
ht_dec.c:frwd_init:
  974|    207|{
  975|    207|    int num, i;
  976|       |
  977|    207|    msp->data = data;
  978|    207|    msp->tmp = 0;
  979|    207|    msp->bits = 0;
  980|    207|    msp->unstuff = OPJ_FALSE;
  ------------------
  |  |  118|    207|#define OPJ_FALSE 0
  ------------------
  981|    207|    msp->size = size;
  982|    207|    msp->X = X;
  983|    207|    assert(msp->X == 0 || msp->X == 0xFF);
  984|       |
  985|       |    //This code is designed for an architecture that read address should
  986|       |    // align to the read size (address multiple of 4 if read size is 4)
  987|       |    //These few lines take care of the case where data is not at a multiple
  988|       |    // of 4 boundary.  It reads 1,2,3 up to 4 bytes from the bitstream
  989|    207|    num = 4 - (int)((intptr_t)(msp->data) & 0x3);
  990|    739|    for (i = 0; i < num; ++i) {
  ------------------
  |  Branch (990:17): [True: 532, False: 207]
  ------------------
  991|    532|        OPJ_UINT64 d;
  992|       |        //read a byte if the buffer is not exhausted, otherwise set it to X
  993|    532|        d = msp->size-- > 0 ? *msp->data++ : msp->X;
  ------------------
  |  Branch (993:13): [True: 511, False: 21]
  ------------------
  994|    532|        msp->tmp |= (d << msp->bits);      // store data in msp->tmp
  995|    532|        msp->bits += 8u - (msp->unstuff ? 1u : 0u); // number of bits added to msp->tmp
  ------------------
  |  Branch (995:28): [True: 49, False: 483]
  ------------------
  996|    532|        msp->unstuff = ((d & 0xFF) == 0xFF); // unstuffing for next byte
  997|    532|    }
  998|    207|    frwd_read(msp); // read 32 bits more
  999|    207|}
ht_dec.c:frwd_read:
  914|  10.6k|{
  915|  10.6k|    OPJ_UINT32 val;
  916|  10.6k|    OPJ_UINT32 bits;
  917|  10.6k|    OPJ_UINT32 t;
  918|  10.6k|    OPJ_BOOL unstuff;
  919|       |
  920|  10.6k|    assert(msp->bits <= 32); // assert that there is a space for 32 bits
  921|       |
  922|  10.6k|    val = 0u;
  923|  10.6k|    if (msp->size > 3) {
  ------------------
  |  Branch (923:9): [True: 5.38k, False: 5.28k]
  ------------------
  924|  5.38k|        val = read_le_uint32(msp->data);  // read 32 bits
  925|  5.38k|        msp->data += 4;           // increment pointer
  926|  5.38k|        msp->size -= 4;           // reduce size
  927|  5.38k|    } else if (msp->size > 0) {
  ------------------
  |  Branch (927:16): [True: 84, False: 5.20k]
  ------------------
  928|     84|        int i = 0;
  929|     84|        val = msp->X != 0 ? 0xFFFFFFFFu : 0;
  ------------------
  |  Branch (929:15): [True: 45, False: 39]
  ------------------
  930|    249|        while (msp->size > 0) {
  ------------------
  |  Branch (930:16): [True: 165, False: 84]
  ------------------
  931|    165|            OPJ_UINT32 v = *msp->data++;  // read one byte at a time
  932|    165|            OPJ_UINT32 m = ~(0xFFu << i); // mask of location
  933|    165|            val = (val & m) | (v << i);   // put one byte in its correct location
  934|    165|            --msp->size;
  935|    165|            i += 8;
  936|    165|        }
  937|  5.20k|    } else {
  938|  5.20k|        val = msp->X != 0 ? 0xFFFFFFFFu : 0;
  ------------------
  |  Branch (938:15): [True: 4.73k, False: 470]
  ------------------
  939|  5.20k|    }
  940|       |
  941|       |    // we accumulate in t and keep a count of the number of bits in bits
  942|  10.6k|    bits = 8u - (msp->unstuff ? 1u : 0u);
  ------------------
  |  Branch (942:18): [True: 6.07k, False: 4.59k]
  ------------------
  943|  10.6k|    t = val & 0xFF;
  944|  10.6k|    unstuff = ((val & 0xFF) == 0xFF);  // Do we need unstuffing next?
  945|       |
  946|  10.6k|    t |= ((val >> 8) & 0xFF) << bits;
  947|  10.6k|    bits += 8u - (unstuff ? 1u : 0u);
  ------------------
  |  Branch (947:19): [True: 6.04k, False: 4.63k]
  ------------------
  948|  10.6k|    unstuff = (((val >> 8) & 0xFF) == 0xFF);
  949|       |
  950|  10.6k|    t |= ((val >> 16) & 0xFF) << bits;
  951|  10.6k|    bits += 8u - (unstuff ? 1u : 0u);
  ------------------
  |  Branch (951:19): [True: 6.05k, False: 4.61k]
  ------------------
  952|  10.6k|    unstuff = (((val >> 16) & 0xFF) == 0xFF);
  953|       |
  954|  10.6k|    t |= ((val >> 24) & 0xFF) << bits;
  955|  10.6k|    bits += 8u - (unstuff ? 1u : 0u);
  ------------------
  |  Branch (955:19): [True: 6.05k, False: 4.62k]
  ------------------
  956|  10.6k|    msp->unstuff = (((val >> 24) & 0xFF) == 0xFF); // for next byte
  957|       |
  958|  10.6k|    msp->tmp |= ((OPJ_UINT64)t) << msp->bits;  // move data to msp->tmp
  959|  10.6k|    msp->bits += bits;
  960|  10.6k|}
ht_dec.c:rev_init_mrp:
  629|     76|{
  630|     76|    int num, i;
  631|       |
  632|     76|    mrp->data = data + lcup + len2 - 1;
  633|     76|    mrp->size = len2;
  634|     76|    mrp->unstuff = OPJ_TRUE;
  ------------------
  |  |  117|     76|#define OPJ_TRUE 1
  ------------------
  635|     76|    mrp->bits = 0;
  636|     76|    mrp->tmp = 0;
  637|       |
  638|       |    //This code is designed for an architecture that read address should
  639|       |    // align to the read size (address multiple of 4 if read size is 4)
  640|       |    //These few lines take care of the case where data is not at a multiple
  641|       |    // of 4 boundary.  It reads 1,2,3 up to 4 bytes from the MRP stream
  642|     76|    num = 1 + (int)((intptr_t)(mrp->data) & 0x3);
  643|    289|    for (i = 0; i < num; ++i) {
  ------------------
  |  Branch (643:17): [True: 213, False: 76]
  ------------------
  644|    213|        OPJ_UINT64 d;
  645|    213|        OPJ_UINT32 d_bits;
  646|       |
  647|       |        //read a byte, 0 if no more data
  648|    213|        d = (mrp->size-- > 0) ? *mrp->data-- : 0;
  ------------------
  |  Branch (648:13): [True: 213, False: 0]
  ------------------
  649|       |        //check if unstuffing is needed
  650|    213|        d_bits = 8u - ((mrp->unstuff && ((d & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (650:25): [True: 141, False: 72]
  |  Branch (650:41): [True: 47, False: 94]
  ------------------
  651|    213|        mrp->tmp |= d << mrp->bits; // move data to vlcp->tmp
  652|    213|        mrp->bits += d_bits;
  653|    213|        mrp->unstuff = d > 0x8F; // for next byte
  654|    213|    }
  655|     76|    rev_read_mrp(mrp);
  656|     76|}
ht_dec.c:rev_read_mrp:
  560|  1.51k|{
  561|  1.51k|    OPJ_UINT32 val;
  562|  1.51k|    OPJ_UINT32 tmp;
  563|  1.51k|    OPJ_UINT32 bits;
  564|  1.51k|    OPJ_BOOL unstuff;
  565|       |
  566|       |    //process 4 bytes at a time
  567|  1.51k|    if (mrp->bits > 32) {
  ------------------
  |  Branch (567:9): [True: 0, False: 1.51k]
  ------------------
  568|      0|        return;
  569|      0|    }
  570|  1.51k|    val = 0;
  571|  1.51k|    if (mrp->size > 3) { // If there are 3 byte or more
  ------------------
  |  Branch (571:9): [True: 1.21k, False: 300]
  ------------------
  572|       |        // (mrp->data - 3) move pointer back to read 32 bits at once
  573|  1.21k|        val = read_le_uint32(mrp->data - 3); // read 32 bits
  574|  1.21k|        mrp->data -= 4;                      // move back pointer
  575|  1.21k|        mrp->size -= 4;                      // reduce count
  576|  1.21k|    } else if (mrp->size > 0) {
  ------------------
  |  Branch (576:16): [True: 17, False: 283]
  ------------------
  577|     17|        int i = 24;
  578|     37|        while (mrp->size > 0) {
  ------------------
  |  Branch (578:16): [True: 20, False: 17]
  ------------------
  579|     20|            OPJ_UINT32 v = *mrp->data--; // read one byte at a time
  580|     20|            val |= (v << i);             // put byte in its correct location
  581|     20|            --mrp->size;
  582|     20|            i -= 8;
  583|     20|        }
  584|     17|    }
  585|       |
  586|       |
  587|       |    //accumulate in tmp, and keep count in bits
  588|  1.51k|    tmp = val >> 24;
  589|       |
  590|       |    //test if the last byte > 0x8F (unstuff must be true) and this is 0x7F
  591|  1.51k|    bits = 8u - ((mrp->unstuff && (((val >> 24) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (591:19): [True: 427, False: 1.09k]
  |  Branch (591:35): [True: 178, False: 249]
  ------------------
  592|  1.51k|    unstuff = (val >> 24) > 0x8F;
  593|       |
  594|       |    //process the next byte
  595|  1.51k|    tmp |= ((val >> 16) & 0xFF) << bits;
  596|  1.51k|    bits += 8u - ((unstuff && (((val >> 16) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (596:20): [True: 452, False: 1.06k]
  |  Branch (596:31): [True: 179, False: 273]
  ------------------
  597|  1.51k|    unstuff = ((val >> 16) & 0xFF) > 0x8F;
  598|       |
  599|  1.51k|    tmp |= ((val >> 8) & 0xFF) << bits;
  600|  1.51k|    bits += 8u - ((unstuff && (((val >> 8) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (600:20): [True: 423, False: 1.09k]
  |  Branch (600:31): [True: 164, False: 259]
  ------------------
  601|  1.51k|    unstuff = ((val >> 8) & 0xFF) > 0x8F;
  602|       |
  603|  1.51k|    tmp |= (val & 0xFF) << bits;
  604|  1.51k|    bits += 8u - ((unstuff && ((val & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (604:20): [True: 435, False: 1.08k]
  |  Branch (604:31): [True: 182, False: 253]
  ------------------
  605|  1.51k|    unstuff = (val & 0xFF) > 0x8F;
  606|       |
  607|  1.51k|    mrp->tmp |= (OPJ_UINT64)tmp << mrp->bits; // move data to mrp pointer
  608|  1.51k|    mrp->bits += bits;
  609|  1.51k|    mrp->unstuff = unstuff;                   // next byte
  610|  1.51k|}
ht_dec.c:mel_get_run:
  361|  10.8k|{
  362|  10.8k|    int t;
  363|  10.8k|    if (melp->num_runs == 0) { //if no runs, decode more bit from MEL segment
  ------------------
  |  Branch (363:9): [True: 1.51k, False: 9.29k]
  ------------------
  364|  1.51k|        mel_decode(melp);
  365|  1.51k|    }
  366|       |
  367|  10.8k|    t = melp->runs & 0x7F; //retrieve one run
  368|  10.8k|    melp->runs >>= 7;  // remove the retrieved run
  369|  10.8k|    melp->num_runs--;
  370|  10.8k|    return t; // return run
  371|  10.8k|}
ht_dec.c:mel_decode:
  261|  1.51k|{
  262|  1.51k|    static const int mel_exp[13] = { //MEL exponents
  263|  1.51k|        0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5
  264|  1.51k|    };
  265|       |
  266|  1.51k|    if (melp->bits < 6) { // if there are less than 6 bits in tmp
  ------------------
  |  Branch (266:9): [True: 401, False: 1.11k]
  ------------------
  267|    401|        mel_read(melp);    // then read from the MEL bitstream
  268|    401|    }
  269|       |    // 6 bits is the largest decodable MEL cwd
  270|       |
  271|       |    //repeat so long that there is enough decodable bits in tmp,
  272|       |    // and the runs store is not full (num_runs < 8)
  273|  12.7k|    while (melp->bits >= 6 && melp->num_runs < 8) {
  ------------------
  |  Branch (273:12): [True: 12.2k, False: 432]
  |  Branch (273:31): [True: 11.2k, False: 1.08k]
  ------------------
  274|  11.2k|        int eval = mel_exp[melp->k]; // number of bits associated with state
  275|  11.2k|        int run = 0;
  276|  11.2k|        if (melp->tmp & (1ull << 63)) { //The next bit to decode (stored in MSB)
  ------------------
  |  Branch (276:13): [True: 4.00k, False: 7.21k]
  ------------------
  277|       |            //one is found
  278|  4.00k|            run = 1 << eval;
  279|  4.00k|            run--; // consecutive runs of 0 events - 1
  280|  4.00k|            melp->k = melp->k + 1 < 12 ? melp->k + 1 : 12;//increment, max is 12
  ------------------
  |  Branch (280:23): [True: 3.21k, False: 783]
  ------------------
  281|  4.00k|            melp->tmp <<= 1; // consume one bit from tmp
  282|  4.00k|            melp->bits -= 1;
  283|  4.00k|            run = run << 1; // a stretch of zeros not terminating in one
  284|  7.21k|        } else {
  285|       |            //0 is found
  286|  7.21k|            run = (int)(melp->tmp >> (63 - eval)) & ((1 << eval) - 1);
  287|  7.21k|            melp->k = melp->k - 1 > 0 ? melp->k - 1 : 0; //decrement, min is 0
  ------------------
  |  Branch (287:23): [True: 1.44k, False: 5.77k]
  ------------------
  288|  7.21k|            melp->tmp <<= eval + 1; //consume eval + 1 bits (max is 6)
  289|  7.21k|            melp->bits -= eval + 1;
  290|  7.21k|            run = (run << 1) + 1; // a stretch of zeros terminating with one
  291|  7.21k|        }
  292|  11.2k|        eval = melp->num_runs * 7;                 // 7 bits per run
  293|  11.2k|        melp->runs &= ~((OPJ_UINT64)0x3F << eval); // 6 bits are sufficient
  294|  11.2k|        melp->runs |= ((OPJ_UINT64)run) << eval;   // store the value in runs
  295|  11.2k|        melp->num_runs++;                          // increment count
  296|  11.2k|    }
  297|  1.51k|}
ht_dec.c:mel_read:
  179|    401|{
  180|    401|    OPJ_UINT32 val;
  181|    401|    int bits;
  182|    401|    OPJ_UINT32 t;
  183|    401|    OPJ_BOOL unstuff;
  184|       |
  185|    401|    if (melp->bits > 32) { //there are enough bits in the tmp variable
  ------------------
  |  Branch (185:9): [True: 0, False: 401]
  ------------------
  186|      0|        return;    // return without reading new data
  187|      0|    }
  188|       |
  189|    401|    val = 0xFFFFFFFF;      // feed in 0xFF if buffer is exhausted
  190|    401|    if (melp->size > 4) {  // if there is more than 4 bytes the MEL segment
  ------------------
  |  Branch (190:9): [True: 321, False: 80]
  ------------------
  191|    321|        val = read_le_uint32(melp->data);  // read 32 bits from MEL data
  192|    321|        melp->data += 4;           // advance pointer
  193|    321|        melp->size -= 4;           // reduce counter
  194|    321|    } else if (melp->size > 0) { // 4 or less
  ------------------
  |  Branch (194:16): [True: 43, False: 37]
  ------------------
  195|     43|        OPJ_UINT32 m, v;
  196|     43|        int i = 0;
  197|     80|        while (melp->size > 1) {
  ------------------
  |  Branch (197:16): [True: 37, False: 43]
  ------------------
  198|     37|            OPJ_UINT32 v = *melp->data++; // read one byte at a time
  199|     37|            OPJ_UINT32 m = ~(0xFFu << i); // mask of location
  200|     37|            val = (val & m) | (v << i);   // put byte in its correct location
  201|     37|            --melp->size;
  202|     37|            i += 8;
  203|     37|        }
  204|       |        // size equal to 1
  205|     43|        v = *melp->data++;  // the one before the last is different
  206|     43|        v |= 0xF;                         // MEL and VLC segments can overlap
  207|     43|        m = ~(0xFFu << i);
  208|     43|        val = (val & m) | (v << i);
  209|     43|        --melp->size;
  210|     43|    }
  211|       |
  212|       |    // next we unstuff them before adding them to the buffer
  213|    401|    bits = 32 - melp->unstuff;      // number of bits in val, subtract 1 if
  214|       |    // the previously read byte requires
  215|       |    // unstuffing
  216|       |
  217|       |    // data is unstuffed and accumulated in t
  218|       |    // bits has the number of bits in t
  219|    401|    t = val & 0xFF;
  220|    401|    unstuff = ((val & 0xFF) == 0xFF); // true if the byte needs unstuffing
  221|    401|    bits -= unstuff; // there is one less bit in t if unstuffing is needed
  222|    401|    t = t << (8 - unstuff); // move up to make room for the next byte
  223|       |
  224|       |    //this is a repeat of the above
  225|    401|    t |= (val >> 8) & 0xFF;
  226|    401|    unstuff = (((val >> 8) & 0xFF) == 0xFF);
  227|    401|    bits -= unstuff;
  228|    401|    t = t << (8 - unstuff);
  229|       |
  230|    401|    t |= (val >> 16) & 0xFF;
  231|    401|    unstuff = (((val >> 16) & 0xFF) == 0xFF);
  232|    401|    bits -= unstuff;
  233|    401|    t = t << (8 - unstuff);
  234|       |
  235|    401|    t |= (val >> 24) & 0xFF;
  236|    401|    melp->unstuff = (((val >> 24) & 0xFF) == 0xFF);
  237|       |
  238|       |    // move t to tmp, and push the result all the way up, so we read from
  239|       |    // the MSB
  240|    401|    melp->tmp |= ((OPJ_UINT64)t) << (64 - bits - melp->bits);
  241|    401|    melp->bits += bits; //increment the number of bits in tmp
  242|    401|}
ht_dec.c:rev_fetch:
  522|  29.2k|{
  523|  29.2k|    if (vlcp->bits < 32) { // if there are less then 32 bits, read more
  ------------------
  |  Branch (523:9): [True: 5.69k, False: 23.5k]
  ------------------
  524|  5.69k|        rev_read(vlcp);     // read 32 bits, but unstuffing might reduce this
  525|  5.69k|        if (vlcp->bits < 32) { // if there is still space in vlcp->tmp for 32 bits
  ------------------
  |  Branch (525:13): [True: 0, False: 5.69k]
  ------------------
  526|      0|            rev_read(vlcp);    // read another 32
  527|      0|        }
  528|  5.69k|    }
  529|  29.2k|    return (OPJ_UINT32)vlcp->tmp; // return the head (bottom-most) of vlcp->tmp
  530|  29.2k|}
ht_dec.c:rev_advance:
  540|  87.4k|{
  541|  87.4k|    assert(num_bits <= vlcp->bits); // vlcp->tmp must have more than num_bits
  542|  87.4k|    vlcp->tmp >>= num_bits;         // remove bits
  543|  87.4k|    vlcp->bits -= num_bits;         // decrement the number of bits
  544|  87.4k|    return (OPJ_UINT32)vlcp->tmp;
  545|  87.4k|}
ht_dec.c:decode_init_uvlc:
  705|  15.7k|{
  706|       |    //table stores possible decoding three bits from vlc
  707|       |    // there are 8 entries for xx1, x10, 100, 000, where x means do not care
  708|       |    // table value is made up of
  709|       |    // 2 bits in the LSB for prefix length
  710|       |    // 3 bits for suffix length
  711|       |    // 3 bits in the MSB for prefix value (u_pfx in Table 3 of ITU T.814)
  712|  15.7k|    static const OPJ_UINT8 dec[8] = { // the index is the prefix codeword
  713|  15.7k|        3 | (5 << 2) | (5 << 5),        //000 == 000, prefix codeword "000"
  714|  15.7k|        1 | (0 << 2) | (1 << 5),        //001 == xx1, prefix codeword "1"
  715|  15.7k|        2 | (0 << 2) | (2 << 5),        //010 == x10, prefix codeword "01"
  716|  15.7k|        1 | (0 << 2) | (1 << 5),        //011 == xx1, prefix codeword "1"
  717|  15.7k|        3 | (1 << 2) | (3 << 5),        //100 == 100, prefix codeword "001"
  718|  15.7k|        1 | (0 << 2) | (1 << 5),        //101 == xx1, prefix codeword "1"
  719|  15.7k|        2 | (0 << 2) | (2 << 5),        //110 == x10, prefix codeword "01"
  720|  15.7k|        1 | (0 << 2) | (1 << 5)         //111 == xx1, prefix codeword "1"
  721|  15.7k|    };
  722|       |
  723|  15.7k|    OPJ_UINT32 consumed_bits = 0;
  724|  15.7k|    if (mode == 0) { // both u_off are 0
  ------------------
  |  Branch (724:9): [True: 9.25k, False: 6.49k]
  ------------------
  725|  9.25k|        u[0] = u[1] = 1; //Kappa is 1 for initial line
  726|  9.25k|    } else if (mode <= 2) { // u_off are either 01 or 10
  ------------------
  |  Branch (726:16): [True: 1.18k, False: 5.31k]
  ------------------
  727|  1.18k|        OPJ_UINT32 d;
  728|  1.18k|        OPJ_UINT32 suffix_len;
  729|       |
  730|  1.18k|        d = dec[vlc & 0x7];   //look at the least significant 3 bits
  731|  1.18k|        vlc >>= d & 0x3;                 //prefix length
  732|  1.18k|        consumed_bits += d & 0x3;
  733|       |
  734|  1.18k|        suffix_len = ((d >> 2) & 0x7);
  735|  1.18k|        consumed_bits += suffix_len;
  736|       |
  737|  1.18k|        d = (d >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  738|  1.18k|        u[0] = (mode == 1) ? d + 1 : 1; // kappa is 1 for initial line
  ------------------
  |  Branch (738:16): [True: 697, False: 488]
  ------------------
  739|  1.18k|        u[1] = (mode == 1) ? 1 : d + 1; // kappa is 1 for initial line
  ------------------
  |  Branch (739:16): [True: 697, False: 488]
  ------------------
  740|  5.31k|    } else if (mode == 3) { // both u_off are 1, and MEL event is 0
  ------------------
  |  Branch (740:16): [True: 2.91k, False: 2.39k]
  ------------------
  741|  2.91k|        OPJ_UINT32 d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  742|  2.91k|        vlc >>= d1 & 0x3;                // Consume bits
  743|  2.91k|        consumed_bits += d1 & 0x3;
  744|       |
  745|  2.91k|        if ((d1 & 0x3) > 2) {
  ------------------
  |  Branch (745:13): [True: 1.81k, False: 1.10k]
  ------------------
  746|  1.81k|            OPJ_UINT32 suffix_len;
  747|       |
  748|       |            //u_{q_2} prefix
  749|  1.81k|            u[1] = (vlc & 1) + 1 + 1; //Kappa is 1 for initial line
  750|  1.81k|            ++consumed_bits;
  751|  1.81k|            vlc >>= 1;
  752|       |
  753|  1.81k|            suffix_len = ((d1 >> 2) & 0x7);
  754|  1.81k|            consumed_bits += suffix_len;
  755|  1.81k|            d1 = (d1 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  756|  1.81k|            u[0] = d1 + 1; //Kappa is 1 for initial line
  757|  1.81k|        } else {
  758|  1.10k|            OPJ_UINT32 d2;
  759|  1.10k|            OPJ_UINT32 suffix_len;
  760|       |
  761|  1.10k|            d2 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  762|  1.10k|            vlc >>= d2 & 0x3;                // Consume bits
  763|  1.10k|            consumed_bits += d2 & 0x3;
  764|       |
  765|  1.10k|            suffix_len = ((d1 >> 2) & 0x7);
  766|  1.10k|            consumed_bits += suffix_len;
  767|       |
  768|  1.10k|            d1 = (d1 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  769|  1.10k|            u[0] = d1 + 1; //Kappa is 1 for initial line
  770|  1.10k|            vlc >>= suffix_len;
  771|       |
  772|  1.10k|            suffix_len = ((d2 >> 2) & 0x7);
  773|  1.10k|            consumed_bits += suffix_len;
  774|       |
  775|  1.10k|            d2 = (d2 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  776|  1.10k|            u[1] = d2 + 1; //Kappa is 1 for initial line
  777|  1.10k|        }
  778|  2.91k|    } else if (mode == 4) { // both u_off are 1, and MEL event is 1
  ------------------
  |  Branch (778:16): [True: 2.39k, False: 0]
  ------------------
  779|  2.39k|        OPJ_UINT32 d1;
  780|  2.39k|        OPJ_UINT32 d2;
  781|  2.39k|        OPJ_UINT32 suffix_len;
  782|       |
  783|  2.39k|        d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  784|  2.39k|        vlc >>= d1 & 0x3;                // Consume bits
  785|  2.39k|        consumed_bits += d1 & 0x3;
  786|       |
  787|  2.39k|        d2 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  788|  2.39k|        vlc >>= d2 & 0x3;                // Consume bits
  789|  2.39k|        consumed_bits += d2 & 0x3;
  790|       |
  791|  2.39k|        suffix_len = ((d1 >> 2) & 0x7);
  792|  2.39k|        consumed_bits += suffix_len;
  793|       |
  794|  2.39k|        d1 = (d1 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  795|  2.39k|        u[0] = d1 + 3; // add 2+kappa
  796|  2.39k|        vlc >>= suffix_len;
  797|       |
  798|  2.39k|        suffix_len = ((d2 >> 2) & 0x7);
  799|  2.39k|        consumed_bits += suffix_len;
  800|       |
  801|  2.39k|        d2 = (d2 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  802|  2.39k|        u[1] = d2 + 3; // add 2+kappa
  803|  2.39k|    }
  804|  15.7k|    return consumed_bits;
  805|  15.7k|}
ht_dec.c:frwd_fetch:
 1022|  74.6k|{
 1023|  74.6k|    if (msp->bits < 32) {
  ------------------
  |  Branch (1023:9): [True: 10.3k, False: 64.2k]
  ------------------
 1024|  10.3k|        frwd_read(msp);
 1025|  10.3k|        if (msp->bits < 32) { //need to test
  ------------------
  |  Branch (1025:13): [True: 88, False: 10.2k]
  ------------------
 1026|     88|            frwd_read(msp);
 1027|     88|        }
 1028|  10.3k|    }
 1029|  74.6k|    return (OPJ_UINT32)msp->tmp;
 1030|  74.6k|}
ht_dec.c:frwd_advance:
 1009|  74.6k|{
 1010|  74.6k|    assert(num_bits <= msp->bits);
 1011|  74.6k|    msp->tmp >>= num_bits;  // consume num_bits
 1012|  74.6k|    msp->bits -= num_bits;
 1013|  74.6k|}
ht_dec.c:count_leading_zeros:
  109|  34.4k|{
  110|       |#ifdef OPJ_COMPILER_MSVC
  111|       |    unsigned long result = 0;
  112|       |    _BitScanReverse(&result, val);
  113|       |    return 31U ^ (OPJ_UINT32)result;
  114|       |#elif (defined OPJ_COMPILER_GNUC)
  115|       |    return (OPJ_UINT32)__builtin_clz(val);
  116|       |#else
  117|       |    val |= (val >> 1);
  118|       |    val |= (val >> 2);
  119|       |    val |= (val >> 4);
  120|       |    val |= (val >> 8);
  121|       |    val |= (val >> 16);
  122|       |    return 32U - population_count(val);
  123|       |#endif
  124|  34.4k|}
ht_dec.c:decode_noninit_uvlc:
  818|  13.4k|{
  819|       |    //table stores possible decoding three bits from vlc
  820|       |    // there are 8 entries for xx1, x10, 100, 000, where x means do not care
  821|       |    // table value is made up of
  822|       |    // 2 bits in the LSB for prefix length
  823|       |    // 3 bits for suffix length
  824|       |    // 3 bits in the MSB for prefix value (u_pfx in Table 3 of ITU T.814)
  825|  13.4k|    static const OPJ_UINT8 dec[8] = {
  826|  13.4k|        3 | (5 << 2) | (5 << 5), //000 == 000, prefix codeword "000"
  827|  13.4k|        1 | (0 << 2) | (1 << 5), //001 == xx1, prefix codeword "1"
  828|  13.4k|        2 | (0 << 2) | (2 << 5), //010 == x10, prefix codeword "01"
  829|  13.4k|        1 | (0 << 2) | (1 << 5), //011 == xx1, prefix codeword "1"
  830|  13.4k|        3 | (1 << 2) | (3 << 5), //100 == 100, prefix codeword "001"
  831|  13.4k|        1 | (0 << 2) | (1 << 5), //101 == xx1, prefix codeword "1"
  832|  13.4k|        2 | (0 << 2) | (2 << 5), //110 == x10, prefix codeword "01"
  833|  13.4k|        1 | (0 << 2) | (1 << 5)  //111 == xx1, prefix codeword "1"
  834|  13.4k|    };
  835|       |
  836|  13.4k|    OPJ_UINT32 consumed_bits = 0;
  837|  13.4k|    if (mode == 0) {
  ------------------
  |  Branch (837:9): [True: 12.1k, False: 1.35k]
  ------------------
  838|  12.1k|        u[0] = u[1] = 1; //for kappa
  839|  12.1k|    } else if (mode <= 2) { //u_off are either 01 or 10
  ------------------
  |  Branch (839:16): [True: 721, False: 631]
  ------------------
  840|    721|        OPJ_UINT32 d;
  841|    721|        OPJ_UINT32 suffix_len;
  842|       |
  843|    721|        d = dec[vlc & 0x7];  //look at the least significant 3 bits
  844|    721|        vlc >>= d & 0x3;                //prefix length
  845|    721|        consumed_bits += d & 0x3;
  846|       |
  847|    721|        suffix_len = ((d >> 2) & 0x7);
  848|    721|        consumed_bits += suffix_len;
  849|       |
  850|    721|        d = (d >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  851|    721|        u[0] = (mode == 1) ? d + 1 : 1; //for kappa
  ------------------
  |  Branch (851:16): [True: 480, False: 241]
  ------------------
  852|    721|        u[1] = (mode == 1) ? 1 : d + 1; //for kappa
  ------------------
  |  Branch (852:16): [True: 480, False: 241]
  ------------------
  853|    721|    } else if (mode == 3) { // both u_off are 1
  ------------------
  |  Branch (853:16): [True: 631, False: 0]
  ------------------
  854|    631|        OPJ_UINT32 d1;
  855|    631|        OPJ_UINT32 d2;
  856|    631|        OPJ_UINT32 suffix_len;
  857|       |
  858|    631|        d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  859|    631|        vlc >>= d1 & 0x3;                // Consume bits
  860|    631|        consumed_bits += d1 & 0x3;
  861|       |
  862|    631|        d2 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  863|    631|        vlc >>= d2 & 0x3;                // Consume bits
  864|    631|        consumed_bits += d2 & 0x3;
  865|       |
  866|    631|        suffix_len = ((d1 >> 2) & 0x7);
  867|    631|        consumed_bits += suffix_len;
  868|       |
  869|    631|        d1 = (d1 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  870|    631|        u[0] = d1 + 1;  //1 for kappa
  871|    631|        vlc >>= suffix_len;
  872|       |
  873|    631|        suffix_len = ((d2 >> 2) & 0x7);
  874|    631|        consumed_bits += suffix_len;
  875|       |
  876|    631|        d2 = (d2 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  877|    631|        u[1] = d2 + 1;  //1 for kappa
  878|    631|    }
  879|  13.4k|    return consumed_bits;
  880|  13.4k|}
ht_dec.c:rev_fetch_mrp:
  667|  5.54k|{
  668|  5.54k|    if (mrp->bits < 32) { // if there are less than 32 bits in mrp->tmp
  ------------------
  |  Branch (668:9): [True: 1.44k, False: 4.10k]
  ------------------
  669|  1.44k|        rev_read_mrp(mrp);    // read 30-32 bits from mrp
  670|  1.44k|        if (mrp->bits < 32) { // if there is a space of 32 bits
  ------------------
  |  Branch (670:13): [True: 1, False: 1.44k]
  ------------------
  671|      1|            rev_read_mrp(mrp);    // read more
  672|      1|        }
  673|  1.44k|    }
  674|  5.54k|    return (OPJ_UINT32)mrp->tmp;  // return the head of mrp->tmp
  675|  5.54k|}
ht_dec.c:rev_advance_mrp:
  685|  5.54k|{
  686|  5.54k|    assert(num_bits <= mrp->bits); // we must not consume more than mrp->bits
  687|  5.54k|    mrp->tmp >>= num_bits;         // discard the lowest num_bits bits
  688|  5.54k|    mrp->bits -= num_bits;
  689|  5.54k|    return (OPJ_UINT32)mrp->tmp;   // return data after consumption
  690|  5.54k|}
ht_dec.c:population_count:
   81|  5.54k|{
   82|       |#if defined(OPJ_COMPILER_MSVC) && (defined(_M_IX86) || defined(_M_AMD64))
   83|       |    return (OPJ_UINT32)__popcnt(val);
   84|       |#elif defined(OPJ_COMPILER_MSVC) && defined(MSVC_NEON_INTRINSICS)
   85|       |    const __n64 temp = neon_cnt(__uint64ToN64_v(val));
   86|       |    return neon_addv8(temp).n8_i8[0];
   87|       |#elif (defined OPJ_COMPILER_GNUC)
   88|       |    return (OPJ_UINT32)__builtin_popcount(val);
   89|       |#else
   90|       |    val -= ((val >> 1) & 0x55555555);
   91|       |    val = (((val >> 2) & 0x33333333) + (val & 0x33333333));
   92|       |    val = (((val >> 4) + val) & 0x0f0f0f0f);
   93|       |    val += (val >> 8);
   94|       |    val += (val >> 16);
   95|       |    return (OPJ_UINT32)(val & 0x0000003f);
   96|       |#endif
   97|  5.54k|}

opj_image_create0:
   35|  23.7k|{
   36|  23.7k|    opj_image_t *image = (opj_image_t*)opj_calloc(1, sizeof(opj_image_t));
   37|  23.7k|    return image;
   38|  23.7k|}
opj_image_destroy:
   92|  33.8k|{
   93|  33.8k|    if (image) {
  ------------------
  |  Branch (93:9): [True: 23.7k, False: 10.0k]
  ------------------
   94|  23.7k|        if (image->comps) {
  ------------------
  |  Branch (94:13): [True: 23.4k, False: 305]
  ------------------
   95|  23.4k|            OPJ_UINT32 compno;
   96|       |
   97|       |            /* image components */
   98|   100k|            for (compno = 0; compno < image->numcomps; compno++) {
  ------------------
  |  Branch (98:30): [True: 77.1k, False: 23.4k]
  ------------------
   99|  77.1k|                opj_image_comp_t *image_comp = &(image->comps[compno]);
  100|  77.1k|                if (image_comp->data) {
  ------------------
  |  Branch (100:21): [True: 7.47k, False: 69.7k]
  ------------------
  101|  7.47k|                    opj_image_data_free(image_comp->data);
  102|  7.47k|                }
  103|  77.1k|            }
  104|  23.4k|            opj_free(image->comps);
  105|  23.4k|        }
  106|       |
  107|  23.7k|        if (image->icc_profile_buf) {
  ------------------
  |  Branch (107:13): [True: 0, False: 23.7k]
  ------------------
  108|      0|            opj_free(image->icc_profile_buf);
  109|      0|        }
  110|       |
  111|  23.7k|        opj_free(image);
  112|  23.7k|    }
  113|  33.8k|}
opj_image_comp_header_update:
  123|  8.51k|{
  124|  8.51k|    OPJ_UINT32 i, l_width, l_height;
  125|  8.51k|    OPJ_UINT32 l_x0, l_y0, l_x1, l_y1;
  126|  8.51k|    OPJ_UINT32 l_comp_x0, l_comp_y0, l_comp_x1, l_comp_y1;
  127|  8.51k|    opj_image_comp_t* l_img_comp = NULL;
  128|       |
  129|  8.51k|    l_x0 = opj_uint_max(p_cp->tx0, p_image_header->x0);
  130|  8.51k|    l_y0 = opj_uint_max(p_cp->ty0, p_image_header->y0);
  131|  8.51k|    l_x1 = p_cp->tx0 + (p_cp->tw - 1U) *
  132|  8.51k|           p_cp->tdx; /* validity of p_cp members used here checked in opj_j2k_read_siz. Can't overflow. */
  133|  8.51k|    l_y1 = p_cp->ty0 + (p_cp->th - 1U) * p_cp->tdy; /* can't overflow */
  134|  8.51k|    l_x1 = opj_uint_min(opj_uint_adds(l_x1, p_cp->tdx),
  135|  8.51k|                        p_image_header->x1); /* use add saturated to prevent overflow */
  136|  8.51k|    l_y1 = opj_uint_min(opj_uint_adds(l_y1, p_cp->tdy),
  137|  8.51k|                        p_image_header->y1); /* use add saturated to prevent overflow */
  138|       |
  139|  8.51k|    l_img_comp = p_image_header->comps;
  140|  39.3k|    for (i = 0; i < p_image_header->numcomps; ++i) {
  ------------------
  |  Branch (140:17): [True: 30.8k, False: 8.51k]
  ------------------
  141|  30.8k|        l_comp_x0 = opj_uint_ceildiv(l_x0, l_img_comp->dx);
  142|  30.8k|        l_comp_y0 = opj_uint_ceildiv(l_y0, l_img_comp->dy);
  143|  30.8k|        l_comp_x1 = opj_uint_ceildiv(l_x1, l_img_comp->dx);
  144|  30.8k|        l_comp_y1 = opj_uint_ceildiv(l_y1, l_img_comp->dy);
  145|  30.8k|        l_width   = opj_uint_ceildivpow2(l_comp_x1 - l_comp_x0, l_img_comp->factor);
  146|  30.8k|        l_height  = opj_uint_ceildivpow2(l_comp_y1 - l_comp_y0, l_img_comp->factor);
  147|  30.8k|        l_img_comp->w = l_width;
  148|  30.8k|        l_img_comp->h = l_height;
  149|  30.8k|        l_img_comp->x0 = l_comp_x0;
  150|  30.8k|        l_img_comp->y0 = l_comp_y0;
  151|  30.8k|        ++l_img_comp;
  152|  30.8k|    }
  153|  8.51k|}
opj_copy_image_header:
  166|  14.9k|{
  167|  14.9k|    OPJ_UINT32 compno;
  168|       |
  169|       |    /* preconditions */
  170|  14.9k|    assert(p_image_src != 00);
  171|  14.9k|    assert(p_image_dest != 00);
  172|       |
  173|  14.9k|    p_image_dest->x0 = p_image_src->x0;
  174|  14.9k|    p_image_dest->y0 = p_image_src->y0;
  175|  14.9k|    p_image_dest->x1 = p_image_src->x1;
  176|  14.9k|    p_image_dest->y1 = p_image_src->y1;
  177|       |
  178|  14.9k|    if (p_image_dest->comps) {
  ------------------
  |  Branch (178:9): [True: 0, False: 14.9k]
  ------------------
  179|      0|        for (compno = 0; compno < p_image_dest->numcomps; compno++) {
  ------------------
  |  Branch (179:26): [True: 0, False: 0]
  ------------------
  180|      0|            opj_image_comp_t *image_comp = &(p_image_dest->comps[compno]);
  181|      0|            if (image_comp->data) {
  ------------------
  |  Branch (181:17): [True: 0, False: 0]
  ------------------
  182|      0|                opj_image_data_free(image_comp->data);
  183|      0|            }
  184|      0|        }
  185|      0|        opj_free(p_image_dest->comps);
  186|      0|        p_image_dest->comps = NULL;
  187|      0|    }
  188|       |
  189|  14.9k|    p_image_dest->numcomps = p_image_src->numcomps;
  190|       |
  191|  14.9k|    p_image_dest->comps = (opj_image_comp_t*) opj_malloc(p_image_dest->numcomps *
  192|  14.9k|                          sizeof(opj_image_comp_t));
  193|  14.9k|    if (!p_image_dest->comps) {
  ------------------
  |  Branch (193:9): [True: 0, False: 14.9k]
  ------------------
  194|      0|        p_image_dest->comps = NULL;
  195|      0|        p_image_dest->numcomps = 0;
  196|      0|        return;
  197|      0|    }
  198|       |
  199|  60.9k|    for (compno = 0; compno < p_image_dest->numcomps; compno++) {
  ------------------
  |  Branch (199:22): [True: 46.0k, False: 14.9k]
  ------------------
  200|  46.0k|        memcpy(&(p_image_dest->comps[compno]),
  201|  46.0k|               &(p_image_src->comps[compno]),
  202|  46.0k|               sizeof(opj_image_comp_t));
  203|  46.0k|        p_image_dest->comps[compno].data = NULL;
  204|  46.0k|    }
  205|       |
  206|  14.9k|    p_image_dest->color_space = p_image_src->color_space;
  207|  14.9k|    p_image_dest->icc_profile_len = p_image_src->icc_profile_len;
  208|       |
  209|  14.9k|    if (p_image_dest->icc_profile_len) {
  ------------------
  |  Branch (209:9): [True: 0, False: 14.9k]
  ------------------
  210|      0|        p_image_dest->icc_profile_buf = (OPJ_BYTE*)opj_malloc(
  211|      0|                                            p_image_dest->icc_profile_len);
  212|      0|        if (!p_image_dest->icc_profile_buf) {
  ------------------
  |  Branch (212:13): [True: 0, False: 0]
  ------------------
  213|      0|            p_image_dest->icc_profile_buf = NULL;
  214|      0|            p_image_dest->icc_profile_len = 0;
  215|      0|            return;
  216|      0|        }
  217|      0|        memcpy(p_image_dest->icc_profile_buf,
  218|      0|               p_image_src->icc_profile_buf,
  219|      0|               p_image_src->icc_profile_len);
  220|  14.9k|    } else {
  221|  14.9k|        p_image_dest->icc_profile_buf = NULL;
  222|  14.9k|    }
  223|       |
  224|  14.9k|    return;
  225|  14.9k|}

opj_j2k_setup_decoder:
 6749|  8.85k|{
 6750|  8.85k|    if (j2k && parameters) {
  ------------------
  |  Branch (6750:9): [True: 8.85k, False: 0]
  |  Branch (6750:16): [True: 8.85k, False: 0]
  ------------------
 6751|  8.85k|        j2k->m_cp.m_specific_param.m_dec.m_layer = parameters->cp_layer;
 6752|  8.85k|        j2k->m_cp.m_specific_param.m_dec.m_reduce = parameters->cp_reduce;
 6753|       |
 6754|  8.85k|        j2k->dump_state = (parameters->flags & OPJ_DPARAMETERS_DUMP_FLAG);
  ------------------
  |  |  549|  8.85k|#define OPJ_DPARAMETERS_DUMP_FLAG 0x0002
  ------------------
 6755|       |#ifdef USE_JPWL
 6756|       |        j2k->m_cp.correct = parameters->jpwl_correct;
 6757|       |        j2k->m_cp.exp_comps = parameters->jpwl_exp_comps;
 6758|       |        j2k->m_cp.max_tiles = parameters->jpwl_max_tiles;
 6759|       |#endif /* USE_JPWL */
 6760|  8.85k|    }
 6761|  8.85k|}
opj_j2k_end_decompress:
 8470|  7.47k|{
 8471|  7.47k|    (void)p_j2k;
 8472|  7.47k|    (void)p_stream;
 8473|  7.47k|    (void)p_manager;
 8474|  7.47k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.47k|#define OPJ_TRUE 1
  ------------------
 8475|  7.47k|}
opj_j2k_read_header:
 8481|  8.85k|{
 8482|       |    /* preconditions */
 8483|  8.85k|    assert(p_j2k != 00);
 8484|  8.85k|    assert(p_stream != 00);
 8485|  8.85k|    assert(p_manager != 00);
 8486|       |
 8487|       |    /* create an empty image header */
 8488|  8.85k|    p_j2k->m_private_image = opj_image_create0();
 8489|  8.85k|    if (! p_j2k->m_private_image) {
  ------------------
  |  Branch (8489:9): [True: 0, False: 8.85k]
  ------------------
 8490|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8491|      0|    }
 8492|       |
 8493|       |    /* customization of the validation */
 8494|  8.85k|    if (! opj_j2k_setup_decoding_validation(p_j2k, p_manager)) {
  ------------------
  |  Branch (8494:9): [True: 0, False: 8.85k]
  ------------------
 8495|      0|        opj_image_destroy(p_j2k->m_private_image);
 8496|      0|        p_j2k->m_private_image = NULL;
 8497|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8498|      0|    }
 8499|       |
 8500|       |    /* validation of the parameters codec */
 8501|  8.85k|    if (! opj_j2k_exec(p_j2k, p_j2k->m_validation_list, p_stream, p_manager)) {
  ------------------
  |  Branch (8501:9): [True: 0, False: 8.85k]
  ------------------
 8502|      0|        opj_image_destroy(p_j2k->m_private_image);
 8503|      0|        p_j2k->m_private_image = NULL;
 8504|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8505|      0|    }
 8506|       |
 8507|       |    /* customization of the encoding */
 8508|  8.85k|    if (! opj_j2k_setup_header_reading(p_j2k, p_manager)) {
  ------------------
  |  Branch (8508:9): [True: 0, False: 8.85k]
  ------------------
 8509|      0|        opj_image_destroy(p_j2k->m_private_image);
 8510|      0|        p_j2k->m_private_image = NULL;
 8511|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8512|      0|    }
 8513|       |
 8514|       |    /* read header */
 8515|  8.85k|    if (! opj_j2k_exec(p_j2k, p_j2k->m_procedure_list, p_stream, p_manager)) {
  ------------------
  |  Branch (8515:9): [True: 1.37k, False: 7.47k]
  ------------------
 8516|  1.37k|        opj_image_destroy(p_j2k->m_private_image);
 8517|  1.37k|        p_j2k->m_private_image = NULL;
 8518|  1.37k|        return OPJ_FALSE;
  ------------------
  |  |  118|  1.37k|#define OPJ_FALSE 0
  ------------------
 8519|  1.37k|    }
 8520|       |
 8521|  7.47k|    *p_image = opj_image_create0();
 8522|  7.47k|    if (!(*p_image)) {
  ------------------
  |  Branch (8522:9): [True: 0, False: 7.47k]
  ------------------
 8523|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8524|      0|    }
 8525|       |
 8526|       |    /* Copy codestream image information to the output image */
 8527|  7.47k|    opj_copy_image_header(p_j2k->m_private_image, *p_image);
 8528|       |
 8529|  7.47k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.47k|#define OPJ_TRUE 1
  ------------------
 8530|  7.47k|}
opj_j2k_destroy:
 9343|  8.85k|{
 9344|  8.85k|    if (p_j2k == 00) {
  ------------------
  |  Branch (9344:9): [True: 0, False: 8.85k]
  ------------------
 9345|      0|        return;
 9346|      0|    }
 9347|       |
 9348|  8.85k|    if (p_j2k->m_is_decoder) {
  ------------------
  |  Branch (9348:9): [True: 8.85k, False: 0]
  ------------------
 9349|       |
 9350|  8.85k|        if (p_j2k->m_specific_param.m_decoder.m_default_tcp != 00) {
  ------------------
  |  Branch (9350:13): [True: 8.85k, False: 0]
  ------------------
 9351|  8.85k|            opj_j2k_tcp_destroy(p_j2k->m_specific_param.m_decoder.m_default_tcp);
 9352|  8.85k|            opj_free(p_j2k->m_specific_param.m_decoder.m_default_tcp);
 9353|  8.85k|            p_j2k->m_specific_param.m_decoder.m_default_tcp = 00;
 9354|  8.85k|        }
 9355|       |
 9356|  8.85k|        if (p_j2k->m_specific_param.m_decoder.m_header_data != 00) {
  ------------------
  |  Branch (9356:13): [True: 8.85k, False: 0]
  ------------------
 9357|  8.85k|            opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 9358|  8.85k|            p_j2k->m_specific_param.m_decoder.m_header_data = 00;
 9359|  8.85k|            p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 9360|  8.85k|        }
 9361|       |
 9362|  8.85k|        opj_free(p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode);
 9363|  8.85k|        p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode = 00;
 9364|  8.85k|        p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode = 0;
 9365|       |
 9366|  8.85k|        opj_free(p_j2k->m_specific_param.m_decoder.m_tlm.m_tile_part_infos);
 9367|  8.85k|        p_j2k->m_specific_param.m_decoder.m_tlm.m_tile_part_infos = NULL;
 9368|       |
 9369|  8.85k|        opj_free(p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset);
 9370|  8.85k|        p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset = NULL;
 9371|       |
 9372|  8.85k|    } else {
 9373|       |
 9374|      0|        if (p_j2k->m_specific_param.m_encoder.m_encoded_tile_data) {
  ------------------
  |  Branch (9374:13): [True: 0, False: 0]
  ------------------
 9375|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_encoded_tile_data);
 9376|      0|            p_j2k->m_specific_param.m_encoder.m_encoded_tile_data = 00;
 9377|      0|        }
 9378|       |
 9379|      0|        if (p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer) {
  ------------------
  |  Branch (9379:13): [True: 0, False: 0]
  ------------------
 9380|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer);
 9381|      0|            p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer = 00;
 9382|      0|            p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current = 00;
 9383|      0|        }
 9384|       |
 9385|      0|        if (p_j2k->m_specific_param.m_encoder.m_header_tile_data) {
  ------------------
  |  Branch (9385:13): [True: 0, False: 0]
  ------------------
 9386|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data);
 9387|      0|            p_j2k->m_specific_param.m_encoder.m_header_tile_data = 00;
 9388|      0|            p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0;
 9389|      0|        }
 9390|      0|    }
 9391|       |
 9392|  8.85k|    opj_tcd_destroy(p_j2k->m_tcd);
 9393|       |
 9394|  8.85k|    opj_j2k_cp_destroy(&(p_j2k->m_cp));
 9395|  8.85k|    memset(&(p_j2k->m_cp), 0, sizeof(opj_cp_t));
 9396|       |
 9397|  8.85k|    opj_procedure_list_destroy(p_j2k->m_procedure_list);
 9398|  8.85k|    p_j2k->m_procedure_list = 00;
 9399|       |
 9400|  8.85k|    opj_procedure_list_destroy(p_j2k->m_validation_list);
 9401|  8.85k|    p_j2k->m_procedure_list = 00;
 9402|       |
 9403|  8.85k|    j2k_destroy_cstr_index(p_j2k->cstr_index);
 9404|  8.85k|    p_j2k->cstr_index = NULL;
 9405|       |
 9406|  8.85k|    opj_image_destroy(p_j2k->m_private_image);
 9407|  8.85k|    p_j2k->m_private_image = NULL;
 9408|       |
 9409|  8.85k|    opj_image_destroy(p_j2k->m_output_image);
 9410|  8.85k|    p_j2k->m_output_image = NULL;
 9411|       |
 9412|  8.85k|    opj_thread_pool_destroy(p_j2k->m_tp);
 9413|  8.85k|    p_j2k->m_tp = NULL;
 9414|       |
 9415|  8.85k|    opj_free(p_j2k);
 9416|  8.85k|}
j2k_destroy_cstr_index:
 9419|  8.85k|{
 9420|  8.85k|    if (p_cstr_ind) {
  ------------------
  |  Branch (9420:9): [True: 8.85k, False: 0]
  ------------------
 9421|       |
 9422|  8.85k|        if (p_cstr_ind->marker) {
  ------------------
  |  Branch (9422:13): [True: 8.85k, False: 0]
  ------------------
 9423|  8.85k|            opj_free(p_cstr_ind->marker);
 9424|  8.85k|            p_cstr_ind->marker = NULL;
 9425|  8.85k|        }
 9426|       |
 9427|  8.85k|        if (p_cstr_ind->tile_index) {
  ------------------
  |  Branch (9427:13): [True: 8.51k, False: 339]
  ------------------
 9428|  8.51k|            OPJ_UINT32 it_tile = 0;
 9429|       |
 9430|  19.1M|            for (it_tile = 0; it_tile < p_cstr_ind->nb_of_tiles; it_tile++) {
  ------------------
  |  Branch (9430:31): [True: 19.1M, False: 8.51k]
  ------------------
 9431|       |
 9432|  19.1M|                if (p_cstr_ind->tile_index[it_tile].packet_index) {
  ------------------
  |  Branch (9432:21): [True: 0, False: 19.1M]
  ------------------
 9433|      0|                    opj_free(p_cstr_ind->tile_index[it_tile].packet_index);
 9434|      0|                    p_cstr_ind->tile_index[it_tile].packet_index = NULL;
 9435|      0|                }
 9436|       |
 9437|  19.1M|                if (p_cstr_ind->tile_index[it_tile].tp_index) {
  ------------------
  |  Branch (9437:21): [True: 8.00k, False: 19.0M]
  ------------------
 9438|  8.00k|                    opj_free(p_cstr_ind->tile_index[it_tile].tp_index);
 9439|  8.00k|                    p_cstr_ind->tile_index[it_tile].tp_index = NULL;
 9440|  8.00k|                }
 9441|       |
 9442|  19.1M|                if (p_cstr_ind->tile_index[it_tile].marker) {
  ------------------
  |  Branch (9442:21): [True: 19.1M, False: 0]
  ------------------
 9443|  19.1M|                    opj_free(p_cstr_ind->tile_index[it_tile].marker);
 9444|  19.1M|                    p_cstr_ind->tile_index[it_tile].marker = NULL;
 9445|       |
 9446|  19.1M|                }
 9447|  19.1M|            }
 9448|       |
 9449|  8.51k|            opj_free(p_cstr_ind->tile_index);
 9450|  8.51k|            p_cstr_ind->tile_index = NULL;
 9451|  8.51k|        }
 9452|       |
 9453|  8.85k|        opj_free(p_cstr_ind);
 9454|  8.85k|    }
 9455|  8.85k|}
opj_j2k_read_tile_header:
 9697|  7.91k|{
 9698|  7.91k|    OPJ_UINT32 l_current_marker = J2K_MS_SOT;
  ------------------
  |  |   73|  7.91k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
 9699|  7.91k|    OPJ_UINT32 l_marker_size;
 9700|  7.91k|    const opj_dec_memory_marker_handler_t * l_marker_handler = 00;
 9701|  7.91k|    opj_tcp_t * l_tcp = NULL;
 9702|  7.91k|    const OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th;
 9703|       |
 9704|       |    /* preconditions */
 9705|  7.91k|    assert(p_stream != 00);
 9706|  7.91k|    assert(p_j2k != 00);
 9707|  7.91k|    assert(p_manager != 00);
 9708|       |
 9709|       |    /* Reach the End Of Codestream ?*/
 9710|  7.91k|    if (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_EOC) {
  ------------------
  |  Branch (9710:9): [True: 2, False: 7.91k]
  ------------------
 9711|      2|        l_current_marker = J2K_MS_EOC;
  ------------------
  |  |   75|      2|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
 9712|      2|    }
 9713|       |    /* We need to encounter a SOT marker (a new tile-part header) */
 9714|  7.91k|    else if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_TPHSOT) {
  ------------------
  |  Branch (9714:14): [True: 0, False: 7.91k]
  ------------------
 9715|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9716|      0|    }
 9717|       |
 9718|       |    /* Read into the codestream until reach the EOC or ! can_decode ??? FIXME */
 9719|  17.2k|    while ((!p_j2k->m_specific_param.m_decoder.m_can_decode) &&
  ------------------
  |  Branch (9719:12): [True: 16.2k, False: 1.03k]
  ------------------
 9720|  17.2k|            (l_current_marker != J2K_MS_EOC)) {
  ------------------
  |  |   75|  16.2k|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (9720:13): [True: 16.2k, False: 10]
  ------------------
 9721|       |
 9722|  16.2k|        if (p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts > 0 &&
  ------------------
  |  Branch (9722:13): [True: 0, False: 16.2k]
  ------------------
 9723|  16.2k|                p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts <
  ------------------
  |  Branch (9723:17): [True: 0, False: 0]
  ------------------
 9724|      0|                p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts) {
 9725|      0|            OPJ_OFF_T next_tp_sot_pos;
 9726|       |
 9727|      0|            next_tp_sot_pos =
 9728|      0|                p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset[p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts];
 9729|      0|            ++p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts;
 9730|      0|            if (!(opj_stream_read_seek(p_stream,
  ------------------
  |  Branch (9730:17): [True: 0, False: 0]
  ------------------
 9731|      0|                                       next_tp_sot_pos,
 9732|      0|                                       p_manager))) {
 9733|      0|                opj_event_msg(p_manager, EVT_ERROR, "Problem with seek function\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9734|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9735|      0|            }
 9736|       |
 9737|       |            /* Try to read 2 bytes (the marker ID) from stream and copy them into the buffer */
 9738|      0|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9738:17): [True: 0, False: 0]
  ------------------
 9739|      0|                                     p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9740|      0|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9741|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9742|      0|            }
 9743|       |
 9744|       |            /* Read 2 bytes from the buffer as the marker ID */
 9745|      0|            opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9746|      0|                           &l_current_marker,
 9747|      0|                           2);
 9748|       |
 9749|      0|            if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|      0|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9749:17): [True: 0, False: 0]
  ------------------
 9750|      0|                opj_event_msg(p_manager, EVT_ERROR, "Did not get expected SOT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9751|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9752|      0|            }
 9753|      0|        }
 9754|       |
 9755|       |        /* Try to read until the Start Of Data is detected */
 9756|  24.6k|        while (l_current_marker != J2K_MS_SOD) {
  ------------------
  |  |   74|  24.6k|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
  |  Branch (9756:16): [True: 15.1k, False: 9.46k]
  ------------------
 9757|       |
 9758|  15.1k|            if (opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (9758:17): [True: 6.40k, False: 8.78k]
  ------------------
 9759|  6.40k|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 9760|  6.40k|                break;
 9761|  6.40k|            }
 9762|       |
 9763|       |            /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 9764|  8.78k|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9764:17): [True: 14, False: 8.76k]
  ------------------
 9765|  8.78k|                                     p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9766|     14|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     14|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9767|     14|                return OPJ_FALSE;
  ------------------
  |  |  118|     14|#define OPJ_FALSE 0
  ------------------
 9768|     14|            }
 9769|       |
 9770|       |            /* Read 2 bytes from the buffer as the marker size */
 9771|  8.76k|            opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_marker_size,
  ------------------
  |  |   65|  8.76k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9772|  8.76k|                           2);
 9773|       |
 9774|       |            /* Check marker size (does not include marker ID but includes marker size) */
 9775|  8.76k|            if (l_marker_size < 2) {
  ------------------
  |  Branch (9775:17): [True: 16, False: 8.75k]
  ------------------
 9776|     16|                opj_event_msg(p_manager, EVT_ERROR, "Inconsistent marker size\n");
  ------------------
  |  |   66|     16|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9777|     16|                return OPJ_FALSE;
  ------------------
  |  |  118|     16|#define OPJ_FALSE 0
  ------------------
 9778|     16|            }
 9779|       |
 9780|       |            /* cf. https://code.google.com/p/openjpeg/issues/detail?id=226 */
 9781|  8.75k|            if (l_current_marker == 0x8080 &&
  ------------------
  |  Branch (9781:17): [True: 2, False: 8.75k]
  ------------------
 9782|  8.75k|                    opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (9782:21): [True: 1, False: 1]
  ------------------
 9783|      1|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 9784|      1|                break;
 9785|      1|            }
 9786|       |
 9787|       |            /* Why this condition? FIXME */
 9788|  8.75k|            if (p_j2k->m_specific_param.m_decoder.m_state & J2K_STATE_TPH) {
  ------------------
  |  Branch (9788:17): [True: 564, False: 8.18k]
  ------------------
 9789|    564|                if (p_j2k->m_specific_param.m_decoder.m_sot_length < l_marker_size + 2) {
  ------------------
  |  Branch (9789:21): [True: 39, False: 525]
  ------------------
 9790|     39|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     39|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9791|     39|                                  "Sot length is less than marker size + marker ID\n");
 9792|     39|                    return OPJ_FALSE;
  ------------------
  |  |  118|     39|#define OPJ_FALSE 0
  ------------------
 9793|     39|                }
 9794|    525|                p_j2k->m_specific_param.m_decoder.m_sot_length -= (l_marker_size + 2);
 9795|    525|            }
 9796|  8.71k|            l_marker_size -= 2; /* Subtract the size of the marker ID already read */
 9797|       |
 9798|       |            /* Get the marker handler from the marker ID */
 9799|  8.71k|            l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 9800|       |
 9801|       |            /* Check if the marker is known and if it is the right place to find it */
 9802|  8.71k|            if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (9802:17): [True: 24, False: 8.68k]
  ------------------
 9803|     24|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     24|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9804|     24|                              "Marker is not compliant with its position\n");
 9805|     24|                return OPJ_FALSE;
  ------------------
  |  |  118|     24|#define OPJ_FALSE 0
  ------------------
 9806|     24|            }
 9807|       |            /* FIXME manage case of unknown marker as in the main header ? */
 9808|       |
 9809|       |            /* Check if the marker size is compatible with the header data size */
 9810|  8.68k|            if (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) {
  ------------------
  |  Branch (9810:17): [True: 48, False: 8.64k]
  ------------------
 9811|     48|                OPJ_BYTE *new_header_data = NULL;
 9812|       |                /* If we are here, this means we consider this marker as known & we will read it */
 9813|       |                /* Check enough bytes left in stream before allocation */
 9814|     48|                if ((OPJ_OFF_T)l_marker_size >  opj_stream_get_number_byte_left(p_stream)) {
  ------------------
  |  Branch (9814:21): [True: 44, False: 4]
  ------------------
 9815|     44|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     44|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9816|     44|                                  "Marker size inconsistent with stream length\n");
 9817|     44|                    return OPJ_FALSE;
  ------------------
  |  |  118|     44|#define OPJ_FALSE 0
  ------------------
 9818|     44|                }
 9819|      4|                new_header_data = (OPJ_BYTE *) opj_realloc(
 9820|      4|                                      p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size);
 9821|      4|                if (! new_header_data) {
  ------------------
  |  Branch (9821:21): [True: 0, False: 4]
  ------------------
 9822|      0|                    opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 9823|      0|                    p_j2k->m_specific_param.m_decoder.m_header_data = NULL;
 9824|      0|                    p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 9825|      0|                    opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read header\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9826|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9827|      0|                }
 9828|      4|                p_j2k->m_specific_param.m_decoder.m_header_data = new_header_data;
 9829|      4|                p_j2k->m_specific_param.m_decoder.m_header_data_size = l_marker_size;
 9830|      4|            }
 9831|       |
 9832|       |            /* Try to read the rest of the marker segment from stream and copy them into the buffer */
 9833|  8.64k|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9833:17): [True: 52, False: 8.59k]
  ------------------
 9834|  8.64k|                                     p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size,
 9835|  8.64k|                                     p_manager) != l_marker_size) {
 9836|     52|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     52|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9837|     52|                return OPJ_FALSE;
  ------------------
  |  |  118|     52|#define OPJ_FALSE 0
  ------------------
 9838|     52|            }
 9839|       |
 9840|  8.59k|            if (!l_marker_handler->handler) {
  ------------------
  |  Branch (9840:17): [True: 7, False: 8.58k]
  ------------------
 9841|       |                /* See issue #175 */
 9842|      7|                opj_event_msg(p_manager, EVT_ERROR, "Not sure how that happened.\n");
  ------------------
  |  |   66|      7|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9843|      7|                return OPJ_FALSE;
  ------------------
  |  |  118|      7|#define OPJ_FALSE 0
  ------------------
 9844|      7|            }
 9845|       |            /* Read the marker segment with the correct marker handler */
 9846|  8.58k|            if (!(*(l_marker_handler->handler))(p_j2k,
  ------------------
  |  Branch (9846:17): [True: 91, False: 8.49k]
  ------------------
 9847|  8.58k|                                                p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size, p_manager)) {
 9848|     91|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     91|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9849|     91|                              "Fail to read the current marker segment (%#x)\n", l_current_marker);
 9850|     91|                return OPJ_FALSE;
  ------------------
  |  |  118|     91|#define OPJ_FALSE 0
  ------------------
 9851|     91|            }
 9852|       |
 9853|       |            /* Add the marker to the codestream index*/
 9854|  8.49k|            if (OPJ_FALSE == opj_j2k_add_tlmarker(p_j2k->m_current_tile_number,
  ------------------
  |  |  118|  8.49k|#define OPJ_FALSE 0
  ------------------
  |  Branch (9854:17): [True: 0, False: 8.49k]
  ------------------
 9855|  8.49k|                                                  p_j2k->cstr_index,
 9856|  8.49k|                                                  l_marker_handler->id,
 9857|  8.49k|                                                  (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4,
 9858|  8.49k|                                                  l_marker_size + 4)) {
 9859|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add tl marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9860|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9861|      0|            }
 9862|       |
 9863|       |            /* Keep the position of the last SOT marker read */
 9864|  8.49k|            if (l_marker_handler->id == J2K_MS_SOT) {
  ------------------
  |  |   73|  8.49k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9864:17): [True: 8.03k, False: 459]
  ------------------
 9865|  8.03k|                OPJ_UINT32 sot_pos = (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4
 9866|  8.03k|                                     ;
 9867|  8.03k|                if (sot_pos > p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos) {
  ------------------
  |  Branch (9867:21): [True: 8.03k, False: 0]
  ------------------
 9868|  8.03k|                    p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos = sot_pos;
 9869|  8.03k|                }
 9870|  8.03k|            }
 9871|       |
 9872|  8.49k|            if (p_j2k->m_specific_param.m_decoder.m_skip_data) {
  ------------------
  |  Branch (9872:17): [True: 258, False: 8.23k]
  ------------------
 9873|       |                /* Skip the rest of the tile part header*/
 9874|    258|                if (opj_stream_skip(p_stream, p_j2k->m_specific_param.m_decoder.m_sot_length,
  ------------------
  |  Branch (9874:21): [True: 55, False: 203]
  ------------------
 9875|    258|                                    p_manager) != p_j2k->m_specific_param.m_decoder.m_sot_length) {
 9876|     55|                    opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     55|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9877|     55|                    return OPJ_FALSE;
  ------------------
  |  |  118|     55|#define OPJ_FALSE 0
  ------------------
 9878|     55|                }
 9879|    203|                l_current_marker = J2K_MS_SOD; /* Normally we reached a SOD */
  ------------------
  |  |   74|    203|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
 9880|  8.23k|            } else {
 9881|       |                /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer*/
 9882|  8.23k|                if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9882:21): [True: 28, False: 8.20k]
  ------------------
 9883|  8.23k|                                         p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9884|     28|                    opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     28|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9885|     28|                    return OPJ_FALSE;
  ------------------
  |  |  118|     28|#define OPJ_FALSE 0
  ------------------
 9886|     28|                }
 9887|       |                /* Read 2 bytes from the buffer as the new marker ID */
 9888|  8.20k|                opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  8.20k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9889|  8.20k|                               &l_current_marker, 2);
 9890|  8.20k|            }
 9891|  8.49k|        }
 9892|  15.8k|        if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (9892:13): [True: 6.42k, False: 9.43k]
  ------------------
 9893|  15.8k|                && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (9893:20): [True: 6.40k, False: 25]
  ------------------
 9894|  6.40k|            break;
 9895|  6.40k|        }
 9896|       |
 9897|       |        /* If we didn't skip data before, we need to read the SOD marker*/
 9898|  9.46k|        if (! p_j2k->m_specific_param.m_decoder.m_skip_data) {
  ------------------
  |  Branch (9898:13): [True: 9.25k, False: 203]
  ------------------
 9899|       |            /* Try to read the SOD marker and skip data ? FIXME */
 9900|  9.25k|            if (! opj_j2k_read_sod(p_j2k, p_stream, p_manager)) {
  ------------------
  |  Branch (9900:17): [True: 66, False: 9.19k]
  ------------------
 9901|     66|                return OPJ_FALSE;
  ------------------
  |  |  118|     66|#define OPJ_FALSE 0
  ------------------
 9902|     66|            }
 9903|       |
 9904|       |            /* Check if we can use the TLM index to access the next tile-part */
 9905|  9.19k|            if (!p_j2k->m_specific_param.m_decoder.m_can_decode &&
  ------------------
  |  Branch (9905:17): [True: 8.13k, False: 1.05k]
  ------------------
 9906|  9.19k|                    p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec >= 0 &&
  ------------------
  |  Branch (9906:21): [True: 0, False: 8.13k]
  ------------------
 9907|  9.19k|                    p_j2k->m_current_tile_number == (OPJ_UINT32)
  ------------------
  |  Branch (9907:21): [True: 0, False: 0]
  ------------------
 9908|      0|                    p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec &&
 9909|  9.19k|                    !p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid &&
  ------------------
  |  Branch (9909:21): [True: 0, False: 0]
  ------------------
 9910|  9.19k|                    opj_stream_has_seek(p_stream)) {
  ------------------
  |  Branch (9910:21): [True: 0, False: 0]
  ------------------
 9911|      0|                l_tcp = p_j2k->m_cp.tcps + p_j2k->m_current_tile_number;
 9912|      0|                if (l_tcp->m_nb_tile_parts ==
  ------------------
  |  Branch (9912:21): [True: 0, False: 0]
  ------------------
 9913|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].nb_tps &&
 9914|      0|                        (OPJ_UINT32)l_tcp->m_current_tile_part_number + 1 < l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (9914:25): [True: 0, False: 0]
  ------------------
 9915|      0|                    const OPJ_OFF_T next_tp_sot_pos = p_j2k->cstr_index->tile_index[
 9916|      0|                                                          p_j2k->m_current_tile_number].tp_index[l_tcp->m_current_tile_part_number +
 9917|      0|                                                                  1].start_pos;
 9918|       |
 9919|      0|                    if (next_tp_sot_pos != opj_stream_tell(p_stream)) {
  ------------------
  |  Branch (9919:25): [True: 0, False: 0]
  ------------------
 9920|       |#if 0
 9921|       |                        opj_event_msg(p_manager, EVT_INFO,
 9922|       |                                      "opj_j2k_read_tile_header(tile=%u): seek to tile part %u at %" PRId64 "\n",
 9923|       |                                      p_j2k->m_current_tile_number,
 9924|       |                                      l_tcp->m_current_tile_part_number + 1,
 9925|       |                                      next_tp_sot_pos);
 9926|       |#endif
 9927|       |
 9928|      0|                        if (!(opj_stream_read_seek(p_stream,
  ------------------
  |  Branch (9928:29): [True: 0, False: 0]
  ------------------
 9929|      0|                                                   next_tp_sot_pos,
 9930|      0|                                                   p_manager))) {
 9931|      0|                            opj_event_msg(p_manager, EVT_ERROR, "Problem with seek function\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9932|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9933|      0|                        }
 9934|      0|                    }
 9935|       |
 9936|       |                    /* Try to read 2 bytes (the marker ID) from stream and copy them into the buffer */
 9937|      0|                    if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9937:25): [True: 0, False: 0]
  ------------------
 9938|      0|                                             p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9939|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9940|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9941|      0|                    }
 9942|       |
 9943|       |                    /* Read 2 bytes from the buffer as the marker ID */
 9944|      0|                    opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9945|      0|                                   &l_current_marker,
 9946|      0|                                   2);
 9947|       |
 9948|      0|                    if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|      0|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9948:25): [True: 0, False: 0]
  ------------------
 9949|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Did not get expected SOT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9950|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9951|      0|                    }
 9952|       |
 9953|      0|                    continue;
 9954|      0|                }
 9955|      0|            }
 9956|       |
 9957|  9.19k|            if (p_j2k->m_specific_param.m_decoder.m_can_decode &&
  ------------------
  |  Branch (9957:17): [True: 1.05k, False: 8.13k]
  ------------------
 9958|  9.19k|                    !p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked) {
  ------------------
  |  Branch (9958:21): [True: 674, False: 385]
  ------------------
 9959|       |                /* Issue 254 */
 9960|    674|                OPJ_BOOL l_correction_needed;
 9961|       |
 9962|    674|                p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked = 1;
 9963|    674|                if (!opj_j2k_need_nb_tile_parts_correction(p_stream,
  ------------------
  |  Branch (9963:21): [True: 4, False: 670]
  ------------------
 9964|    674|                        p_j2k->m_current_tile_number, &l_correction_needed, p_manager)) {
 9965|      4|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9966|      4|                                  "opj_j2k_apply_nb_tile_parts_correction error\n");
 9967|      4|                    return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 9968|      4|                }
 9969|    670|                if (l_correction_needed) {
  ------------------
  |  Branch (9969:21): [True: 18, False: 652]
  ------------------
 9970|     18|                    OPJ_UINT32 l_tile_no;
 9971|       |
 9972|     18|                    p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
 9973|     18|                    p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction = 1;
 9974|       |                    /* correct tiles */
 9975|  2.78k|                    for (l_tile_no = 0U; l_tile_no < l_nb_tiles; ++l_tile_no) {
  ------------------
  |  Branch (9975:42): [True: 2.76k, False: 18]
  ------------------
 9976|  2.76k|                        if (p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts != 0U) {
  ------------------
  |  Branch (9976:29): [True: 29, False: 2.73k]
  ------------------
 9977|     29|                            p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts += 1;
 9978|     29|                        }
 9979|  2.76k|                    }
 9980|     18|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     18|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 9981|     18|                                  "Non conformant codestream TPsot==TNsot.\n");
 9982|     18|                }
 9983|    670|            }
 9984|  9.19k|        } else {
 9985|       |            /* Indicate we will try to read a new tile-part header*/
 9986|    203|            p_j2k->m_specific_param.m_decoder.m_skip_data = 0;
 9987|    203|            p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
 9988|    203|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 9989|    203|        }
 9990|       |
 9991|  9.39k|        if (! p_j2k->m_specific_param.m_decoder.m_can_decode) {
  ------------------
  |  Branch (9991:13): [True: 8.35k, False: 1.03k]
  ------------------
 9992|       |            /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 9993|  8.35k|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9993:17): [True: 25, False: 8.32k]
  ------------------
 9994|  8.35k|                                     p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9995|       |
 9996|       |                /* Deal with likely non conformant SPOT6 files, where the last */
 9997|       |                /* row of tiles have TPsot == 0 and TNsot == 0, and missing EOC, */
 9998|       |                /* but no other tile-parts were found. */
 9999|     25|                if (p_j2k->m_current_tile_number + 1 == l_nb_tiles) {
  ------------------
  |  Branch (9999:21): [True: 21, False: 4]
  ------------------
10000|     21|                    OPJ_UINT32 l_tile_no;
10001|    405|                    for (l_tile_no = 0U; l_tile_no < l_nb_tiles; ++l_tile_no) {
  ------------------
  |  Branch (10001:42): [True: 386, False: 19]
  ------------------
10002|    386|                        if (p_j2k->m_cp.tcps[l_tile_no].m_current_tile_part_number == 0 &&
  ------------------
  |  Branch (10002:29): [True: 52, False: 334]
  ------------------
10003|    386|                                p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts == 0) {
  ------------------
  |  Branch (10003:33): [True: 2, False: 50]
  ------------------
10004|      2|                            break;
10005|      2|                        }
10006|    386|                    }
10007|     21|                    if (l_tile_no < l_nb_tiles) {
  ------------------
  |  Branch (10007:25): [True: 2, False: 19]
  ------------------
10008|      2|                        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|      2|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10009|      2|                                      "Tile %u has TPsot == 0 and TNsot == 0, "
10010|      2|                                      "but no other tile-parts were found. "
10011|      2|                                      "EOC is also missing.\n",
10012|      2|                                      l_tile_no);
10013|      2|                        p_j2k->m_current_tile_number = l_tile_no;
10014|      2|                        l_current_marker = J2K_MS_EOC;
  ------------------
  |  |   75|      2|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
10015|      2|                        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
10016|      2|                        break;
10017|      2|                    }
10018|     21|                }
10019|       |
10020|     23|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     23|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10021|     23|                return OPJ_FALSE;
  ------------------
  |  |  118|     23|#define OPJ_FALSE 0
  ------------------
10022|     25|            }
10023|       |
10024|       |            /* Read 2 bytes from buffer as the new marker ID */
10025|  8.32k|            opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  8.32k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10026|  8.32k|                           &l_current_marker, 2);
10027|  8.32k|        }
10028|  9.39k|    }
10029|       |
10030|       |    /* Current marker is the EOC marker ?*/
10031|  7.45k|    if (l_current_marker == J2K_MS_EOC) {
  ------------------
  |  |   75|  7.45k|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (10031:9): [True: 12, False: 7.44k]
  ------------------
10032|     12|        if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
  ------------------
  |  Branch (10032:13): [True: 8, False: 4]
  ------------------
10033|      8|            p_j2k->m_current_tile_number = 0;
10034|      8|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
10035|      8|        }
10036|     12|    }
10037|       |
10038|       |    /* Deal with tiles that have a single tile-part with TPsot == 0 and TNsot == 0 */
10039|  7.45k|    if (! p_j2k->m_specific_param.m_decoder.m_can_decode) {
  ------------------
  |  Branch (10039:9): [True: 6.40k, False: 1.04k]
  ------------------
10040|  6.40k|        l_tcp = p_j2k->m_cp.tcps + p_j2k->m_current_tile_number;
10041|       |
10042|   270k|        while ((p_j2k->m_current_tile_number < l_nb_tiles) && (l_tcp->m_data == 00)) {
  ------------------
  |  Branch (10042:16): [True: 270k, False: 54]
  |  Branch (10042:63): [True: 263k, False: 6.35k]
  ------------------
10043|   263k|            ++p_j2k->m_current_tile_number;
10044|   263k|            ++l_tcp;
10045|   263k|        }
10046|       |
10047|  6.40k|        if (p_j2k->m_current_tile_number == l_nb_tiles) {
  ------------------
  |  Branch (10047:13): [True: 54, False: 6.35k]
  ------------------
10048|     54|            *p_go_on = OPJ_FALSE;
  ------------------
  |  |  118|     54|#define OPJ_FALSE 0
  ------------------
10049|     54|            return OPJ_TRUE;
  ------------------
  |  |  117|     54|#define OPJ_TRUE 1
  ------------------
10050|     54|        }
10051|  6.40k|    }
10052|       |
10053|  7.39k|    if (! opj_j2k_merge_ppt(p_j2k->m_cp.tcps + p_j2k->m_current_tile_number,
  ------------------
  |  Branch (10053:9): [True: 0, False: 7.39k]
  ------------------
10054|  7.39k|                            p_manager)) {
10055|      0|        opj_event_msg(p_manager, EVT_ERROR, "Failed to merge PPT data\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10056|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10057|      0|    }
10058|       |    /*FIXME ???*/
10059|  7.39k|    if (! opj_tcd_init_decode_tile(p_j2k->m_tcd, p_j2k->m_current_tile_number,
  ------------------
  |  Branch (10059:9): [True: 36, False: 7.36k]
  ------------------
10060|  7.39k|                                   p_manager)) {
10061|     36|        opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n");
  ------------------
  |  |   66|     36|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10062|     36|        return OPJ_FALSE;
  ------------------
  |  |  118|     36|#define OPJ_FALSE 0
  ------------------
10063|     36|    }
10064|       |
10065|  7.36k|    opj_event_msg(p_manager, EVT_INFO, "Header of tile %d / %d has been read.\n",
  ------------------
  |  |   68|  7.36k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10066|  7.36k|                  p_j2k->m_current_tile_number + 1, (p_j2k->m_cp.th * p_j2k->m_cp.tw));
10067|       |
10068|  7.36k|    *p_tile_index = p_j2k->m_current_tile_number;
10069|  7.36k|    *p_go_on = OPJ_TRUE;
  ------------------
  |  |  117|  7.36k|#define OPJ_TRUE 1
  ------------------
10070|  7.36k|    if (p_data_size) {
  ------------------
  |  Branch (10070:9): [True: 0, False: 7.36k]
  ------------------
10071|       |        /* For internal use in j2k.c, we don't need this */
10072|       |        /* This is just needed for folks using the opj_read_tile_header() / opj_decode_tile_data() combo */
10073|      0|        *p_data_size = opj_tcd_get_decoded_tile_size(p_j2k->m_tcd, OPJ_FALSE);
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10074|      0|        if (*p_data_size == UINT_MAX) {
  ------------------
  |  Branch (10074:13): [True: 0, False: 0]
  ------------------
10075|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10076|      0|        }
10077|      0|    }
10078|  7.36k|    *p_tile_x0 = p_j2k->m_tcd->tcd_image->tiles->x0;
10079|  7.36k|    *p_tile_y0 = p_j2k->m_tcd->tcd_image->tiles->y0;
10080|  7.36k|    *p_tile_x1 = p_j2k->m_tcd->tcd_image->tiles->x1;
10081|  7.36k|    *p_tile_y1 = p_j2k->m_tcd->tcd_image->tiles->y1;
10082|  7.36k|    *p_nb_comps = p_j2k->m_tcd->tcd_image->tiles->numcomps;
10083|       |
10084|  7.36k|    p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_DATA;
10085|       |
10086|  7.36k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.36k|#define OPJ_TRUE 1
  ------------------
10087|  7.36k|}
opj_j2k_decode_tile:
10095|  7.36k|{
10096|  7.36k|    OPJ_UINT32 l_current_marker;
10097|  7.36k|    OPJ_BYTE l_data [2];
10098|  7.36k|    opj_tcp_t * l_tcp;
10099|  7.36k|    opj_image_t* l_image_for_bounds;
10100|       |
10101|       |    /* preconditions */
10102|  7.36k|    assert(p_stream != 00);
10103|  7.36k|    assert(p_j2k != 00);
10104|  7.36k|    assert(p_manager != 00);
10105|       |
10106|  7.36k|    if (!(p_j2k->m_specific_param.m_decoder.m_state & J2K_STATE_DATA)
  ------------------
  |  Branch (10106:9): [True: 0, False: 7.36k]
  ------------------
10107|  7.36k|            || (p_tile_index != p_j2k->m_current_tile_number)) {
  ------------------
  |  Branch (10107:16): [True: 0, False: 7.36k]
  ------------------
10108|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10109|      0|    }
10110|       |
10111|  7.36k|    l_tcp = &(p_j2k->m_cp.tcps[p_tile_index]);
10112|  7.36k|    if (! l_tcp->m_data) {
  ------------------
  |  Branch (10112:9): [True: 8, False: 7.35k]
  ------------------
10113|      8|        opj_j2k_tcp_destroy(l_tcp);
10114|      8|        return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
10115|      8|    }
10116|       |
10117|       |    /* When using the opj_read_tile_header / opj_decode_tile_data API */
10118|       |    /* such as in test_tile_decoder, m_output_image is NULL, so fall back */
10119|       |    /* to the full image dimension. This is a bit surprising that */
10120|       |    /* opj_set_decode_area() is only used to determine intersecting tiles, */
10121|       |    /* but full tile decoding is done */
10122|  7.35k|    l_image_for_bounds = p_j2k->m_output_image ? p_j2k->m_output_image :
  ------------------
  |  Branch (10122:26): [True: 7.35k, False: 0]
  ------------------
10123|  7.35k|                         p_j2k->m_private_image;
10124|  7.35k|    if (! opj_tcd_decode_tile(p_j2k->m_tcd,
  ------------------
  |  Branch (10124:9): [True: 5.20k, False: 2.14k]
  ------------------
10125|  7.35k|                              l_image_for_bounds->x0,
10126|  7.35k|                              l_image_for_bounds->y0,
10127|  7.35k|                              l_image_for_bounds->x1,
10128|  7.35k|                              l_image_for_bounds->y1,
10129|  7.35k|                              p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode,
10130|  7.35k|                              p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode,
10131|  7.35k|                              l_tcp->m_data,
10132|  7.35k|                              l_tcp->m_data_size,
10133|  7.35k|                              p_tile_index,
10134|  7.35k|                              p_j2k->cstr_index, p_manager)) {
10135|  5.20k|        opj_j2k_tcp_destroy(l_tcp);
10136|  5.20k|        p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_ERR;
10137|  5.20k|        opj_event_msg(p_manager, EVT_ERROR, "Failed to decode.\n");
  ------------------
  |  |   66|  5.20k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10138|  5.20k|        return OPJ_FALSE;
  ------------------
  |  |  118|  5.20k|#define OPJ_FALSE 0
  ------------------
10139|  5.20k|    }
10140|       |
10141|       |    /* p_data can be set to NULL when the call will take care of using */
10142|       |    /* itself the TCD data. This is typically the case for whole single */
10143|       |    /* tile decoding optimization. */
10144|  2.14k|    if (p_data != NULL) {
  ------------------
  |  Branch (10144:9): [True: 0, False: 2.14k]
  ------------------
10145|      0|        if (! opj_tcd_update_tile_data(p_j2k->m_tcd, p_data, p_data_size)) {
  ------------------
  |  Branch (10145:13): [True: 0, False: 0]
  ------------------
10146|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10147|      0|        }
10148|       |
10149|       |        /* To avoid to destroy the tcp which can be useful when we try to decode a tile decoded before (cf j2k_random_tile_access)
10150|       |        * we destroy just the data which will be re-read in read_tile_header*/
10151|       |        /*opj_j2k_tcp_destroy(l_tcp);
10152|       |        p_j2k->m_tcd->tcp = 0;*/
10153|      0|        opj_j2k_tcp_data_destroy(l_tcp);
10154|      0|    }
10155|       |
10156|  2.14k|    p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
10157|  2.14k|    p_j2k->m_specific_param.m_decoder.m_state &= (~(OPJ_UINT32)J2K_STATE_DATA);
10158|       |
10159|  2.14k|    if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (10159:9): [True: 1.58k, False: 566]
  ------------------
10160|  2.14k|            && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (10160:16): [True: 1.57k, False: 2]
  ------------------
10161|  1.57k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.57k|#define OPJ_TRUE 1
  ------------------
10162|  1.57k|    }
10163|       |
10164|    568|    if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
  ------------------
  |  Branch (10164:9): [True: 566, False: 2]
  ------------------
10165|    566|        if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (10165:13): [True: 12, False: 554]
  ------------------
10166|     12|            opj_event_msg(p_manager, p_j2k->m_cp.strict ? EVT_ERROR : EVT_WARNING,
  ------------------
  |  |   66|     12|#define EVT_ERROR   1   /**< Error event type */
  ------------------
                          opj_event_msg(p_manager, p_j2k->m_cp.strict ? EVT_ERROR : EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
  |  Branch (10166:38): [True: 12, False: 0]
  ------------------
10167|     12|                          "Stream too short\n");
10168|     12|            return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
  ------------------
  |  |  118|     12|#define OPJ_FALSE 0
  ------------------
                          return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  |  Branch (10168:20): [True: 12, False: 0]
  ------------------
10169|     12|        }
10170|    554|        opj_read_bytes(l_data, &l_current_marker, 2);
  ------------------
  |  |   65|    554|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10171|       |
10172|    554|        if (l_current_marker == J2K_MS_EOC) {
  ------------------
  |  |   75|    554|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (10172:13): [True: 0, False: 554]
  ------------------
10173|      0|            p_j2k->m_current_tile_number = 0;
10174|      0|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
10175|    554|        } else if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|    554|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (10175:20): [True: 64, False: 490]
  ------------------
10176|     64|            if (opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (10176:17): [True: 20, False: 44]
  ------------------
10177|     20|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
10178|     20|                opj_event_msg(p_manager, EVT_WARNING, "Stream does not end with EOC\n");
  ------------------
  |  |   67|     20|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10179|     20|                return OPJ_TRUE;
  ------------------
  |  |  117|     20|#define OPJ_TRUE 1
  ------------------
10180|     20|            }
10181|     44|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short, expected SOT\n");
  ------------------
  |  |   66|     44|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10182|     44|            return OPJ_FALSE;
  ------------------
  |  |  118|     44|#define OPJ_FALSE 0
  ------------------
10183|     64|        }
10184|    554|    }
10185|       |
10186|    492|    return OPJ_TRUE;
  ------------------
  |  |  117|    492|#define OPJ_TRUE 1
  ------------------
10187|    568|}
opj_j2k_set_decode_area:
10521|  7.47k|{
10522|  7.47k|    opj_cp_t * l_cp = &(p_j2k->m_cp);
10523|  7.47k|    opj_image_t * l_image = p_j2k->m_private_image;
10524|  7.47k|    OPJ_BOOL ret;
10525|  7.47k|    OPJ_UINT32 it_comp;
10526|       |
10527|  7.47k|    if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (10527:9): [True: 6.40k, False: 1.07k]
  |  Branch (10527:32): [True: 3.66k, False: 2.73k]
  ------------------
10528|  7.47k|            p_j2k->m_cp.tcps[0].m_data != NULL) {
  ------------------
  |  Branch (10528:13): [True: 0, False: 3.66k]
  ------------------
10529|       |        /* In the case of a single-tiled image whose codestream we have already */
10530|       |        /* ingested, go on */
10531|      0|    }
10532|       |    /* Check if we are read the main header */
10533|  7.47k|    else if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_TPHSOT) {
  ------------------
  |  Branch (10533:14): [True: 0, False: 7.47k]
  ------------------
10534|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10535|      0|                      "Need to decode the main header before begin to decode the remaining codestream.\n");
10536|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10537|      0|    }
10538|       |
10539|       |    /* Update the comps[].factor member of the output image with the one */
10540|       |    /* of m_reduce */
10541|  30.5k|    for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (10541:23): [True: 23.0k, False: 7.47k]
  ------------------
10542|  23.0k|        p_image->comps[it_comp].factor = p_j2k->m_cp.m_specific_param.m_dec.m_reduce;
10543|  23.0k|    }
10544|       |
10545|  7.47k|    if (!p_start_x && !p_start_y && !p_end_x && !p_end_y) {
  ------------------
  |  Branch (10545:9): [True: 3.54k, False: 3.93k]
  |  Branch (10545:23): [True: 1.50k, False: 2.03k]
  |  Branch (10545:37): [True: 0, False: 1.50k]
  |  Branch (10545:49): [True: 0, False: 0]
  ------------------
10546|      0|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|      0|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10547|      0|                      "No decoded area parameters, set the decoded area to the whole image\n");
10548|       |
10549|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
10550|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
10551|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
10552|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
10553|       |
10554|      0|        p_image->x0 = l_image->x0;
10555|      0|        p_image->y0 = l_image->y0;
10556|      0|        p_image->x1 = l_image->x1;
10557|      0|        p_image->y1 = l_image->y1;
10558|       |
10559|      0|        return opj_j2k_update_image_dimensions(p_image, p_manager);
10560|      0|    }
10561|       |
10562|       |    /* ----- */
10563|       |    /* Check if the positions provided by the user are correct */
10564|       |
10565|       |    /* Left */
10566|  7.47k|    if (p_start_x < 0) {
  ------------------
  |  Branch (10566:9): [True: 13, False: 7.46k]
  ------------------
10567|     13|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     13|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10568|     13|                      "Left position of the decoded area (region_x0=%d) should be >= 0.\n",
10569|     13|                      p_start_x);
10570|     13|        return OPJ_FALSE;
  ------------------
  |  |  118|     13|#define OPJ_FALSE 0
  ------------------
10571|  7.46k|    } else if ((OPJ_UINT32)p_start_x > l_image->x1) {
  ------------------
  |  Branch (10571:16): [True: 0, False: 7.46k]
  ------------------
10572|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10573|      0|                      "Left position of the decoded area (region_x0=%d) is outside the image area (Xsiz=%d).\n",
10574|      0|                      p_start_x, l_image->x1);
10575|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10576|  7.46k|    } else if ((OPJ_UINT32)p_start_x < l_image->x0) {
  ------------------
  |  Branch (10576:16): [True: 0, False: 7.46k]
  ------------------
10577|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10578|      0|                      "Left position of the decoded area (region_x0=%d) is outside the image area (XOsiz=%d).\n",
10579|      0|                      p_start_x, l_image->x0);
10580|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
10581|      0|        p_image->x0 = l_image->x0;
10582|  7.46k|    } else {
10583|  7.46k|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = ((OPJ_UINT32)p_start_x -
10584|  7.46k|                l_cp->tx0) / l_cp->tdx;
10585|  7.46k|        p_image->x0 = (OPJ_UINT32)p_start_x;
10586|  7.46k|    }
10587|       |
10588|       |    /* Up */
10589|  7.46k|    if (p_start_y < 0) {
  ------------------
  |  Branch (10589:9): [True: 20, False: 7.44k]
  ------------------
10590|     20|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     20|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10591|     20|                      "Up position of the decoded area (region_y0=%d) should be >= 0.\n",
10592|     20|                      p_start_y);
10593|     20|        return OPJ_FALSE;
  ------------------
  |  |  118|     20|#define OPJ_FALSE 0
  ------------------
10594|  7.44k|    } else if ((OPJ_UINT32)p_start_y > l_image->y1) {
  ------------------
  |  Branch (10594:16): [True: 0, False: 7.44k]
  ------------------
10595|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10596|      0|                      "Up position of the decoded area (region_y0=%d) is outside the image area (Ysiz=%d).\n",
10597|      0|                      p_start_y, l_image->y1);
10598|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10599|  7.44k|    } else if ((OPJ_UINT32)p_start_y < l_image->y0) {
  ------------------
  |  Branch (10599:16): [True: 0, False: 7.44k]
  ------------------
10600|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10601|      0|                      "Up position of the decoded area (region_y0=%d) is outside the image area (YOsiz=%d).\n",
10602|      0|                      p_start_y, l_image->y0);
10603|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
10604|      0|        p_image->y0 = l_image->y0;
10605|  7.44k|    } else {
10606|  7.44k|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = ((OPJ_UINT32)p_start_y -
10607|  7.44k|                l_cp->ty0) / l_cp->tdy;
10608|  7.44k|        p_image->y0 = (OPJ_UINT32)p_start_y;
10609|  7.44k|    }
10610|       |
10611|       |    /* Right */
10612|  7.44k|    if (p_end_x <= 0) {
  ------------------
  |  Branch (10612:9): [True: 1, False: 7.44k]
  ------------------
10613|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10614|      1|                      "Right position of the decoded area (region_x1=%d) should be > 0.\n",
10615|      1|                      p_end_x);
10616|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
10617|  7.44k|    } else if ((OPJ_UINT32)p_end_x < l_image->x0) {
  ------------------
  |  Branch (10617:16): [True: 0, False: 7.44k]
  ------------------
10618|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10619|      0|                      "Right position of the decoded area (region_x1=%d) is outside the image area (XOsiz=%d).\n",
10620|      0|                      p_end_x, l_image->x0);
10621|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10622|  7.44k|    } else if ((OPJ_UINT32)p_end_x > l_image->x1) {
  ------------------
  |  Branch (10622:16): [True: 0, False: 7.44k]
  ------------------
10623|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10624|      0|                      "Right position of the decoded area (region_x1=%d) is outside the image area (Xsiz=%d).\n",
10625|      0|                      p_end_x, l_image->x1);
10626|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
10627|      0|        p_image->x1 = l_image->x1;
10628|  7.44k|    } else {
10629|  7.44k|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = opj_uint_ceildiv((
10630|  7.44k|                    OPJ_UINT32)p_end_x - l_cp->tx0, l_cp->tdx);
10631|  7.44k|        p_image->x1 = (OPJ_UINT32)p_end_x;
10632|  7.44k|    }
10633|       |
10634|       |    /* Bottom */
10635|  7.44k|    if (p_end_y <= 0) {
  ------------------
  |  Branch (10635:9): [True: 1, False: 7.44k]
  ------------------
10636|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10637|      1|                      "Bottom position of the decoded area (region_y1=%d) should be > 0.\n",
10638|      1|                      p_end_y);
10639|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
10640|  7.44k|    } else if ((OPJ_UINT32)p_end_y < l_image->y0) {
  ------------------
  |  Branch (10640:16): [True: 0, False: 7.44k]
  ------------------
10641|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10642|      0|                      "Bottom position of the decoded area (region_y1=%d) is outside the image area (YOsiz=%d).\n",
10643|      0|                      p_end_y, l_image->y0);
10644|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10645|      0|    }
10646|  7.44k|    if ((OPJ_UINT32)p_end_y > l_image->y1) {
  ------------------
  |  Branch (10646:9): [True: 0, False: 7.44k]
  ------------------
10647|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10648|      0|                      "Bottom position of the decoded area (region_y1=%d) is outside the image area (Ysiz=%d).\n",
10649|      0|                      p_end_y, l_image->y1);
10650|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
10651|      0|        p_image->y1 = l_image->y1;
10652|  7.44k|    } else {
10653|  7.44k|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = opj_uint_ceildiv((
10654|  7.44k|                    OPJ_UINT32)p_end_y - l_cp->ty0, l_cp->tdy);
10655|  7.44k|        p_image->y1 = (OPJ_UINT32)p_end_y;
10656|  7.44k|    }
10657|       |    /* ----- */
10658|       |
10659|  7.44k|    p_j2k->m_specific_param.m_decoder.m_discard_tiles = 1;
10660|       |
10661|  7.44k|    ret = opj_j2k_update_image_dimensions(p_image, p_manager);
10662|       |
10663|  7.44k|    if (ret) {
  ------------------
  |  Branch (10663:9): [True: 7.44k, False: 0]
  ------------------
10664|  7.44k|        opj_event_msg(p_manager, EVT_INFO, "Setting decoding area to %d,%d,%d,%d\n",
  ------------------
  |  |   68|  7.44k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10665|  7.44k|                      p_image->x0, p_image->y0, p_image->x1, p_image->y1);
10666|  7.44k|    }
10667|       |
10668|  7.44k|    return ret;
10669|  7.44k|}
opj_j2k_create_decompress:
10672|  8.85k|{
10673|  8.85k|    opj_j2k_t *l_j2k = (opj_j2k_t*) opj_calloc(1, sizeof(opj_j2k_t));
10674|  8.85k|    if (!l_j2k) {
  ------------------
  |  Branch (10674:9): [True: 0, False: 8.85k]
  ------------------
10675|      0|        return 00;
10676|      0|    }
10677|       |
10678|  8.85k|    l_j2k->m_is_decoder = 1;
10679|  8.85k|    l_j2k->m_cp.m_is_decoder = 1;
10680|       |    /* in the absence of JP2 boxes, consider different bit depth / sign */
10681|       |    /* per component is allowed */
10682|  8.85k|    l_j2k->m_cp.allow_different_bit_depth_sign = 1;
10683|       |
10684|       |    /* Default to using strict mode. */
10685|  8.85k|    l_j2k->m_cp.strict = OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
10686|       |
10687|       |#ifdef OPJ_DISABLE_TPSOT_FIX
10688|       |    l_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked = 1;
10689|       |#endif
10690|       |
10691|  8.85k|    l_j2k->m_specific_param.m_decoder.m_default_tcp = (opj_tcp_t*) opj_calloc(1,
10692|  8.85k|            sizeof(opj_tcp_t));
10693|  8.85k|    if (!l_j2k->m_specific_param.m_decoder.m_default_tcp) {
  ------------------
  |  Branch (10693:9): [True: 0, False: 8.85k]
  ------------------
10694|      0|        opj_j2k_destroy(l_j2k);
10695|      0|        return 00;
10696|      0|    }
10697|       |
10698|  8.85k|    l_j2k->m_specific_param.m_decoder.m_header_data = (OPJ_BYTE *) opj_calloc(1,
10699|  8.85k|            OPJ_J2K_DEFAULT_HEADER_SIZE);
  ------------------
  |  |  159|  8.85k|#define OPJ_J2K_DEFAULT_HEADER_SIZE         1000
  ------------------
10700|  8.85k|    if (! l_j2k->m_specific_param.m_decoder.m_header_data) {
  ------------------
  |  Branch (10700:9): [True: 0, False: 8.85k]
  ------------------
10701|      0|        opj_j2k_destroy(l_j2k);
10702|      0|        return 00;
10703|      0|    }
10704|       |
10705|  8.85k|    l_j2k->m_specific_param.m_decoder.m_header_data_size =
10706|  8.85k|        OPJ_J2K_DEFAULT_HEADER_SIZE;
  ------------------
  |  |  159|  8.85k|#define OPJ_J2K_DEFAULT_HEADER_SIZE         1000
  ------------------
10707|       |
10708|  8.85k|    l_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec = -1 ;
10709|       |
10710|  8.85k|    l_j2k->m_specific_param.m_decoder.m_last_sot_read_pos = 0 ;
10711|       |
10712|       |    /* codestream index creation */
10713|  8.85k|    l_j2k->cstr_index = opj_j2k_create_cstr_index();
10714|  8.85k|    if (!l_j2k->cstr_index) {
  ------------------
  |  Branch (10714:9): [True: 0, False: 8.85k]
  ------------------
10715|      0|        opj_j2k_destroy(l_j2k);
10716|      0|        return 00;
10717|      0|    }
10718|       |
10719|       |    /* validation list creation */
10720|  8.85k|    l_j2k->m_validation_list = opj_procedure_list_create();
10721|  8.85k|    if (! l_j2k->m_validation_list) {
  ------------------
  |  Branch (10721:9): [True: 0, False: 8.85k]
  ------------------
10722|      0|        opj_j2k_destroy(l_j2k);
10723|      0|        return 00;
10724|      0|    }
10725|       |
10726|       |    /* execution list creation */
10727|  8.85k|    l_j2k->m_procedure_list = opj_procedure_list_create();
10728|  8.85k|    if (! l_j2k->m_procedure_list) {
  ------------------
  |  Branch (10728:9): [True: 0, False: 8.85k]
  ------------------
10729|      0|        opj_j2k_destroy(l_j2k);
10730|      0|        return 00;
10731|      0|    }
10732|       |
10733|  8.85k|    l_j2k->m_tp = opj_thread_pool_create(opj_j2k_get_default_thread_count());
10734|  8.85k|    if (!l_j2k->m_tp) {
  ------------------
  |  Branch (10734:9): [True: 0, False: 8.85k]
  ------------------
10735|      0|        l_j2k->m_tp = opj_thread_pool_create(0);
10736|      0|    }
10737|  8.85k|    if (!l_j2k->m_tp) {
  ------------------
  |  Branch (10737:9): [True: 0, False: 8.85k]
  ------------------
10738|      0|        opj_j2k_destroy(l_j2k);
10739|      0|        return NULL;
10740|      0|    }
10741|       |
10742|  8.85k|    return l_j2k;
10743|  8.85k|}
opj_j2k_decode:
12359|  7.44k|{
12360|  7.44k|    if (!p_image) {
  ------------------
  |  Branch (12360:9): [True: 0, False: 7.44k]
  ------------------
12361|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12362|      0|    }
12363|       |
12364|       |    /* Heuristics to detect sequence opj_read_header(), opj_set_decoded_resolution_factor() */
12365|       |    /* and finally opj_decode_image() without manual setting of comps[].factor */
12366|       |    /* We could potentially always execute it, if we don't allow people to do */
12367|       |    /* opj_read_header(), modify x0,y0,x1,y1 of returned image an call opj_decode_image() */
12368|  7.44k|    if (p_j2k->m_cp.m_specific_param.m_dec.m_reduce > 0 &&
  ------------------
  |  Branch (12368:9): [True: 0, False: 7.44k]
  ------------------
12369|  7.44k|            p_j2k->m_private_image != NULL &&
  ------------------
  |  Branch (12369:13): [True: 0, False: 0]
  ------------------
12370|  7.44k|            p_j2k->m_private_image->numcomps > 0 &&
  ------------------
  |  Branch (12370:13): [True: 0, False: 0]
  ------------------
12371|  7.44k|            p_j2k->m_private_image->comps[0].factor ==
  ------------------
  |  Branch (12371:13): [True: 0, False: 0]
  ------------------
12372|      0|            p_j2k->m_cp.m_specific_param.m_dec.m_reduce &&
12373|  7.44k|            p_image->numcomps > 0 &&
  ------------------
  |  Branch (12373:13): [True: 0, False: 0]
  ------------------
12374|  7.44k|            p_image->comps[0].factor == 0 &&
  ------------------
  |  Branch (12374:13): [True: 0, False: 0]
  ------------------
12375|       |            /* Don't mess with image dimension if the user has allocated it */
12376|  7.44k|            p_image->comps[0].data == NULL) {
  ------------------
  |  Branch (12376:13): [True: 0, False: 0]
  ------------------
12377|      0|        OPJ_UINT32 it_comp;
12378|       |
12379|       |        /* Update the comps[].factor member of the output image with the one */
12380|       |        /* of m_reduce */
12381|      0|        for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (12381:27): [True: 0, False: 0]
  ------------------
12382|      0|            p_image->comps[it_comp].factor = p_j2k->m_cp.m_specific_param.m_dec.m_reduce;
12383|      0|        }
12384|      0|        if (!opj_j2k_update_image_dimensions(p_image, p_manager)) {
  ------------------
  |  Branch (12384:13): [True: 0, False: 0]
  ------------------
12385|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12386|      0|        }
12387|      0|    }
12388|       |
12389|  7.44k|    if (p_j2k->m_output_image == NULL) {
  ------------------
  |  Branch (12389:9): [True: 7.44k, False: 0]
  ------------------
12390|  7.44k|        p_j2k->m_output_image = opj_image_create0();
12391|  7.44k|        if (!(p_j2k->m_output_image)) {
  ------------------
  |  Branch (12391:13): [True: 0, False: 7.44k]
  ------------------
12392|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12393|      0|        }
12394|  7.44k|    }
12395|  7.44k|    opj_copy_image_header(p_image, p_j2k->m_output_image);
12396|       |
12397|       |    /* customization of the decoding */
12398|  7.44k|    if (!opj_j2k_setup_decoding(p_j2k, p_manager)) {
  ------------------
  |  Branch (12398:9): [True: 0, False: 7.44k]
  ------------------
12399|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12400|      0|    }
12401|       |
12402|       |    /* Decode the codestream */
12403|  7.44k|    if (! opj_j2k_exec(p_j2k, p_j2k->m_procedure_list, p_stream, p_manager)) {
  ------------------
  |  Branch (12403:9): [True: 5.88k, False: 1.56k]
  ------------------
12404|  5.88k|        opj_image_destroy(p_j2k->m_private_image);
12405|  5.88k|        p_j2k->m_private_image = NULL;
12406|  5.88k|        return OPJ_FALSE;
  ------------------
  |  |  118|  5.88k|#define OPJ_FALSE 0
  ------------------
12407|  5.88k|    }
12408|       |
12409|       |    /* Move data and copy one information from codec to output image*/
12410|  1.56k|    return opj_j2k_move_data_from_codec_to_output_image(p_j2k, p_image);
12411|  7.44k|}
j2k.c:opj_j2k_get_default_thread_count:
 6790|  8.85k|{
 6791|  8.85k|    const char* num_threads_str = getenv("OPJ_NUM_THREADS");
 6792|  8.85k|    int num_cpus;
 6793|  8.85k|    int num_threads;
 6794|       |
 6795|  8.85k|    if (num_threads_str == NULL || !opj_has_thread_support()) {
  ------------------
  |  Branch (6795:9): [True: 8.85k, False: 0]
  |  Branch (6795:36): [True: 0, False: 0]
  ------------------
 6796|  8.85k|        return 0;
 6797|  8.85k|    }
 6798|      0|    num_cpus = opj_get_num_cpus();
 6799|      0|    if (strcmp(num_threads_str, "ALL_CPUS") == 0) {
  ------------------
  |  Branch (6799:9): [True: 0, False: 0]
  ------------------
 6800|      0|        return num_cpus;
 6801|      0|    }
 6802|      0|    if (num_cpus == 0) {
  ------------------
  |  Branch (6802:9): [True: 0, False: 0]
  ------------------
 6803|      0|        num_cpus = 32;
 6804|      0|    }
 6805|      0|    num_threads = atoi(num_threads_str);
 6806|      0|    if (num_threads < 0) {
  ------------------
  |  Branch (6806:9): [True: 0, False: 0]
  ------------------
 6807|      0|        num_threads = 0;
 6808|      0|    } else if (num_threads > 2 * num_cpus) {
  ------------------
  |  Branch (6808:16): [True: 0, False: 0]
  ------------------
 6809|      0|        num_threads = 2 * num_cpus;
 6810|      0|    }
 6811|      0|    return num_threads;
 6812|      0|}
j2k.c:opj_j2k_setup_header_reading:
 8534|  8.85k|{
 8535|       |    /* preconditions*/
 8536|  8.85k|    assert(p_j2k != 00);
 8537|  8.85k|    assert(p_manager != 00);
 8538|       |
 8539|  8.85k|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (8539:9): [True: 0, False: 8.85k]
  ------------------
 8540|  8.85k|                                           (opj_procedure)opj_j2k_read_header_procedure, p_manager)) {
 8541|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8542|      0|    }
 8543|       |
 8544|       |    /* DEVELOPER CORNER, add your custom procedures */
 8545|  8.85k|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (8545:9): [True: 0, False: 8.85k]
  ------------------
 8546|  8.85k|                                           (opj_procedure)opj_j2k_copy_default_tcp_and_create_tcd, p_manager))  {
 8547|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8548|      0|    }
 8549|       |
 8550|  8.85k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
 8551|  8.85k|}
j2k.c:opj_j2k_read_header_procedure:
 8964|  8.85k|{
 8965|  8.85k|    OPJ_UINT32 l_current_marker;
 8966|  8.85k|    OPJ_UINT32 l_marker_size;
 8967|  8.85k|    const opj_dec_memory_marker_handler_t * l_marker_handler = 00;
 8968|  8.85k|    OPJ_BOOL l_has_siz = 0;
 8969|  8.85k|    OPJ_BOOL l_has_cod = 0;
 8970|  8.85k|    OPJ_BOOL l_has_qcd = 0;
 8971|       |
 8972|       |    /* preconditions */
 8973|  8.85k|    assert(p_stream != 00);
 8974|  8.85k|    assert(p_j2k != 00);
 8975|  8.85k|    assert(p_manager != 00);
 8976|       |
 8977|       |    /*  We enter in the main header */
 8978|  8.85k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_MHSOC;
 8979|       |
 8980|       |    /* Try to read the SOC marker, the codestream must begin with SOC marker */
 8981|  8.85k|    if (! opj_j2k_read_soc(p_j2k, p_stream, p_manager)) {
  ------------------
  |  Branch (8981:9): [True: 0, False: 8.85k]
  ------------------
 8982|      0|        opj_event_msg(p_manager, EVT_ERROR, "Expected a SOC marker \n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8983|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8984|      0|    }
 8985|       |
 8986|       |    /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 8987|  8.85k|    if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (8987:9): [True: 1, False: 8.84k]
  ------------------
 8988|  8.85k|                             p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 8989|      1|        opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8990|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 8991|      1|    }
 8992|       |
 8993|       |    /* Read 2 bytes as the new marker ID */
 8994|  8.84k|    opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  8.84k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 8995|  8.84k|                   &l_current_marker, 2);
 8996|       |
 8997|       |    /* Try to read until the SOT is detected */
 8998|  93.3k|    while (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|  93.3k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (8998:12): [True: 86.5k, False: 6.80k]
  ------------------
 8999|       |
 9000|       |        /* Check if the current marker ID is valid */
 9001|  86.5k|        if (l_current_marker < 0xff00) {
  ------------------
  |  Branch (9001:13): [True: 174, False: 86.3k]
  ------------------
 9002|    174|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    174|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9003|    174|                          "A marker ID was expected (0xff--) instead of %.8x\n", l_current_marker);
 9004|    174|            return OPJ_FALSE;
  ------------------
  |  |  118|    174|#define OPJ_FALSE 0
  ------------------
 9005|    174|        }
 9006|       |
 9007|       |        /* Get the marker handler from the marker ID */
 9008|  86.3k|        l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 9009|       |
 9010|       |        /* Manage case where marker is unknown */
 9011|  86.3k|        if (l_marker_handler->id == J2K_MS_UNK) {
  ------------------
  |  |   99|  86.3k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
  |  Branch (9011:13): [True: 49.5k, False: 36.7k]
  ------------------
 9012|  49.5k|            if (! opj_j2k_read_unk(p_j2k, p_stream, &l_current_marker, p_manager)) {
  ------------------
  |  Branch (9012:17): [True: 182, False: 49.4k]
  ------------------
 9013|    182|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    182|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9014|    182|                              "Unknown marker has been detected and generated error.\n");
 9015|    182|                return OPJ_FALSE;
  ------------------
  |  |  118|    182|#define OPJ_FALSE 0
  ------------------
 9016|    182|            }
 9017|       |
 9018|  49.4k|            if (l_current_marker == J2K_MS_SOT) {
  ------------------
  |  |   73|  49.4k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9018:17): [True: 737, False: 48.6k]
  ------------------
 9019|    737|                break;    /* SOT marker is detected main header is completely read */
 9020|  48.6k|            } else { /* Get the marker handler from the marker ID */
 9021|  48.6k|                l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 9022|  48.6k|            }
 9023|  49.4k|        }
 9024|       |
 9025|  85.4k|        if (l_marker_handler->id == J2K_MS_SIZ) {
  ------------------
  |  |   77|  85.4k|#define J2K_MS_SIZ 0xff51   /**< SIZ marker value */
  ------------------
  |  Branch (9025:13): [True: 8.76k, False: 76.6k]
  ------------------
 9026|       |            /* Mark required SIZ marker as found */
 9027|  8.76k|            l_has_siz = 1;
 9028|  8.76k|        }
 9029|  85.4k|        if (l_marker_handler->id == J2K_MS_COD) {
  ------------------
  |  |   78|  85.4k|#define J2K_MS_COD 0xff52   /**< COD marker value */
  ------------------
  |  Branch (9029:13): [True: 9.32k, False: 76.0k]
  ------------------
 9030|       |            /* Mark required COD marker as found */
 9031|  9.32k|            l_has_cod = 1;
 9032|  9.32k|        }
 9033|  85.4k|        if (l_marker_handler->id == J2K_MS_QCD) {
  ------------------
  |  |   82|  85.4k|#define J2K_MS_QCD 0xff5c   /**< QCD marker value */
  ------------------
  |  Branch (9033:13): [True: 9.85k, False: 75.5k]
  ------------------
 9034|       |            /* Mark required QCD marker as found */
 9035|  9.85k|            l_has_qcd = 1;
 9036|  9.85k|        }
 9037|       |
 9038|       |        /* Check if the marker is known and if it is the right place to find it */
 9039|  85.4k|        if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (9039:13): [True: 10, False: 85.4k]
  ------------------
 9040|     10|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9041|     10|                          "Marker is not compliant with its position\n");
 9042|     10|            return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 9043|     10|        }
 9044|       |
 9045|       |        /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 9046|  85.4k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9046:13): [True: 50, False: 85.3k]
  ------------------
 9047|  85.4k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9048|     50|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     50|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9049|     50|            return OPJ_FALSE;
  ------------------
  |  |  118|     50|#define OPJ_FALSE 0
  ------------------
 9050|     50|        }
 9051|       |
 9052|       |        /* read 2 bytes as the marker size */
 9053|  85.3k|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_marker_size,
  ------------------
  |  |   65|  85.3k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9054|  85.3k|                       2);
 9055|  85.3k|        if (l_marker_size < 2) {
  ------------------
  |  Branch (9055:13): [True: 12, False: 85.3k]
  ------------------
 9056|     12|            opj_event_msg(p_manager, EVT_ERROR, "Invalid marker size\n");
  ------------------
  |  |   66|     12|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9057|     12|            return OPJ_FALSE;
  ------------------
  |  |  118|     12|#define OPJ_FALSE 0
  ------------------
 9058|     12|        }
 9059|  85.3k|        l_marker_size -= 2; /* Subtract the size of the marker ID already read */
 9060|       |
 9061|       |        /* Check if the marker size is compatible with the header data size */
 9062|  85.3k|        if (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) {
  ------------------
  |  Branch (9062:13): [True: 92, False: 85.2k]
  ------------------
 9063|     92|            OPJ_BYTE *new_header_data = (OPJ_BYTE *) opj_realloc(
 9064|     92|                                            p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size);
 9065|     92|            if (! new_header_data) {
  ------------------
  |  Branch (9065:17): [True: 0, False: 92]
  ------------------
 9066|      0|                opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 9067|      0|                p_j2k->m_specific_param.m_decoder.m_header_data = NULL;
 9068|      0|                p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 9069|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read header\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9070|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9071|      0|            }
 9072|     92|            p_j2k->m_specific_param.m_decoder.m_header_data = new_header_data;
 9073|     92|            p_j2k->m_specific_param.m_decoder.m_header_data_size = l_marker_size;
 9074|     92|        }
 9075|       |
 9076|       |        /* Try to read the rest of the marker segment from stream and copy them into the buffer */
 9077|  85.3k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9077:13): [True: 202, False: 85.1k]
  ------------------
 9078|  85.3k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size,
 9079|  85.3k|                                 p_manager) != l_marker_size) {
 9080|    202|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|    202|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9081|    202|            return OPJ_FALSE;
  ------------------
  |  |  118|    202|#define OPJ_FALSE 0
  ------------------
 9082|    202|        }
 9083|       |
 9084|       |        /* Read the marker segment with the correct marker handler */
 9085|  85.1k|        if (!(*(l_marker_handler->handler))(p_j2k,
  ------------------
  |  Branch (9085:13): [True: 366, False: 84.7k]
  ------------------
 9086|  85.1k|                                            p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size, p_manager)) {
 9087|    366|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    366|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9088|    366|                          "Marker handler function failed to read the marker segment\n");
 9089|    366|            return OPJ_FALSE;
  ------------------
  |  |  118|    366|#define OPJ_FALSE 0
  ------------------
 9090|    366|        }
 9091|       |
 9092|       |        /* Add the marker to the codestream index*/
 9093|  84.7k|        if (OPJ_FALSE == opj_j2k_add_mhmarker(
  ------------------
  |  |  118|  84.7k|#define OPJ_FALSE 0
  ------------------
  |  Branch (9093:13): [True: 0, False: 84.7k]
  ------------------
 9094|  84.7k|                    p_j2k->cstr_index,
 9095|  84.7k|                    l_marker_handler->id,
 9096|  84.7k|                    (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4,
 9097|  84.7k|                    l_marker_size + 4)) {
 9098|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add mh marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9099|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9100|      0|        }
 9101|       |
 9102|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 9103|  84.7k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9103:13): [True: 311, False: 84.4k]
  ------------------
 9104|  84.7k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9105|    311|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|    311|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9106|    311|            return OPJ_FALSE;
  ------------------
  |  |  118|    311|#define OPJ_FALSE 0
  ------------------
 9107|    311|        }
 9108|       |
 9109|       |        /* read 2 bytes as the new marker ID */
 9110|  84.4k|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  84.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9111|  84.4k|                       &l_current_marker, 2);
 9112|  84.4k|    }
 9113|       |
 9114|  7.54k|    if (l_has_siz == 0) {
  ------------------
  |  Branch (9114:9): [True: 1, False: 7.54k]
  ------------------
 9115|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9116|      1|                      "required SIZ marker not found in main header\n");
 9117|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9118|      1|    }
 9119|  7.54k|    if (l_has_cod == 0) {
  ------------------
  |  Branch (9119:9): [True: 4, False: 7.53k]
  ------------------
 9120|      4|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9121|      4|                      "required COD marker not found in main header\n");
 9122|      4|        return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 9123|      4|    }
 9124|  7.53k|    if (l_has_qcd == 0) {
  ------------------
  |  Branch (9124:9): [True: 2, False: 7.53k]
  ------------------
 9125|      2|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9126|      2|                      "required QCD marker not found in main header\n");
 9127|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 9128|      2|    }
 9129|       |
 9130|  7.53k|    if (! opj_j2k_merge_ppm(&(p_j2k->m_cp), p_manager)) {
  ------------------
  |  Branch (9130:9): [True: 56, False: 7.47k]
  ------------------
 9131|     56|        opj_event_msg(p_manager, EVT_ERROR, "Failed to merge PPM data\n");
  ------------------
  |  |   66|     56|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9132|     56|        return OPJ_FALSE;
  ------------------
  |  |  118|     56|#define OPJ_FALSE 0
  ------------------
 9133|     56|    }
 9134|       |
 9135|  7.47k|    opj_event_msg(p_manager, EVT_INFO, "Main header has been correctly decoded.\n");
  ------------------
  |  |   68|  7.47k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 9136|       |
 9137|       |    /* Position of the last element if the main header */
 9138|  7.47k|    p_j2k->cstr_index->main_head_end = (OPJ_UINT32) opj_stream_tell(p_stream) - 2;
 9139|       |
 9140|       |    /* Build tile-part index from TLM information */
 9141|  7.47k|    opj_j2k_build_tp_index_from_tlm(p_j2k, p_manager);
 9142|       |
 9143|       |    /* Next step: read a tile-part header */
 9144|  7.47k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 9145|       |
 9146|  7.47k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.47k|#define OPJ_TRUE 1
  ------------------
 9147|  7.53k|}
j2k.c:opj_j2k_read_soc:
 1931|  8.85k|{
 1932|  8.85k|    OPJ_BYTE l_data [2];
 1933|  8.85k|    OPJ_UINT32 l_marker;
 1934|       |
 1935|       |    /* preconditions */
 1936|  8.85k|    assert(p_j2k != 00);
 1937|  8.85k|    assert(p_manager != 00);
 1938|  8.85k|    assert(p_stream != 00);
 1939|       |
 1940|  8.85k|    if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (1940:9): [True: 0, False: 8.85k]
  ------------------
 1941|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1942|      0|    }
 1943|       |
 1944|  8.85k|    opj_read_bytes(l_data, &l_marker, 2);
  ------------------
  |  |   65|  8.85k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1945|  8.85k|    if (l_marker != J2K_MS_SOC) {
  ------------------
  |  |   72|  8.85k|#define J2K_MS_SOC 0xff4f   /**< SOC marker value */
  ------------------
  |  Branch (1945:9): [True: 0, False: 8.85k]
  ------------------
 1946|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1947|      0|    }
 1948|       |
 1949|       |    /* Next marker should be a SIZ marker in the main header */
 1950|  8.85k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_MHSIZ;
 1951|       |
 1952|       |    /* FIXME move it in a index structure included in p_j2k*/
 1953|  8.85k|    p_j2k->cstr_index->main_head_start = opj_stream_tell(p_stream) - 2;
 1954|       |
 1955|  8.85k|    opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|  8.85k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 1956|  8.85k|                  "Start to read j2k main header (%" PRId64 ").\n",
 1957|  8.85k|                  p_j2k->cstr_index->main_head_start);
 1958|       |
 1959|       |    /* Add the marker to the codestream index*/
 1960|  8.85k|    if (OPJ_FALSE == opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_SOC,
  ------------------
  |  |  118|  8.85k|#define OPJ_FALSE 0
  ------------------
                  if (OPJ_FALSE == opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_SOC,
  ------------------
  |  |   72|  8.85k|#define J2K_MS_SOC 0xff4f   /**< SOC marker value */
  ------------------
  |  Branch (1960:9): [True: 0, False: 8.85k]
  ------------------
 1961|  8.85k|                                          p_j2k->cstr_index->main_head_start, 2)) {
 1962|      0|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add mh marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1963|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1964|      0|    }
 1965|  8.85k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
 1966|  8.85k|}
j2k.c:opj_j2k_read_unk:
 5732|  49.5k|{
 5733|  49.5k|    OPJ_UINT32 l_unknown_marker;
 5734|  49.5k|    const opj_dec_memory_marker_handler_t * l_marker_handler;
 5735|  49.5k|    OPJ_UINT32 l_size_unk = 2;
 5736|       |
 5737|       |    /* preconditions*/
 5738|  49.5k|    assert(p_j2k != 00);
 5739|  49.5k|    assert(p_manager != 00);
 5740|  49.5k|    assert(p_stream != 00);
 5741|       |
 5742|  49.5k|    opj_event_msg(p_manager, EVT_WARNING, "Unknown marker\n");
  ------------------
  |  |   67|  49.5k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5743|       |
 5744|  1.53M|    for (;;) {
 5745|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer*/
 5746|  1.53M|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (5746:13): [True: 166, False: 1.53M]
  ------------------
 5747|  1.53M|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 5748|    166|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|    166|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5749|    166|            return OPJ_FALSE;
  ------------------
  |  |  118|    166|#define OPJ_FALSE 0
  ------------------
 5750|    166|        }
 5751|       |
 5752|       |        /* read 2 bytes as the new marker ID*/
 5753|  1.53M|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  1.53M|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5754|  1.53M|                       &l_unknown_marker, 2);
 5755|       |
 5756|  1.53M|        if (!(l_unknown_marker < 0xff00)) {
  ------------------
  |  Branch (5756:13): [True: 119k, False: 1.41M]
  ------------------
 5757|       |
 5758|       |            /* Get the marker handler from the marker ID*/
 5759|   119k|            l_marker_handler = opj_j2k_get_marker_handler(l_unknown_marker);
 5760|       |
 5761|   119k|            if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (5761:17): [True: 16, False: 119k]
  ------------------
 5762|     16|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     16|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5763|     16|                              "Marker is not compliant with its position\n");
 5764|     16|                return OPJ_FALSE;
  ------------------
  |  |  118|     16|#define OPJ_FALSE 0
  ------------------
 5765|   119k|            } else {
 5766|   119k|                if (l_marker_handler->id != J2K_MS_UNK) {
  ------------------
  |  |   99|   119k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
  |  Branch (5766:21): [True: 49.4k, False: 69.9k]
  ------------------
 5767|       |                    /* Add the marker to the codestream index*/
 5768|  49.4k|                    if (l_marker_handler->id != J2K_MS_SOT) {
  ------------------
  |  |   73|  49.4k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (5768:25): [True: 48.6k, False: 737]
  ------------------
 5769|  48.6k|                        OPJ_BOOL res = opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_UNK,
  ------------------
  |  |   99|  48.6k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
 5770|  48.6k|                                                            (OPJ_UINT32) opj_stream_tell(p_stream) - l_size_unk,
 5771|  48.6k|                                                            l_size_unk);
 5772|  48.6k|                        if (res == OPJ_FALSE) {
  ------------------
  |  |  118|  48.6k|#define OPJ_FALSE 0
  ------------------
  |  Branch (5772:29): [True: 0, False: 48.6k]
  ------------------
 5773|      0|                            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add mh marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5774|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5775|      0|                        }
 5776|  48.6k|                    }
 5777|  49.4k|                    break; /* next marker is known and well located */
 5778|  69.9k|                } else {
 5779|  69.9k|                    l_size_unk += 2;
 5780|  69.9k|                }
 5781|   119k|            }
 5782|   119k|        }
 5783|  1.53M|    }
 5784|       |
 5785|  49.4k|    *output_marker = l_marker_handler->id ;
 5786|       |
 5787|  49.4k|    return OPJ_TRUE;
  ------------------
  |  |  117|  49.4k|#define OPJ_TRUE 1
  ------------------
 5788|  49.5k|}
j2k.c:opj_j2k_add_mhmarker:
 8384|   142k|{
 8385|   142k|    assert(cstr_index != 00);
 8386|       |
 8387|       |    /* expand the list? */
 8388|   142k|    if ((cstr_index->marknum + 1) > cstr_index->maxmarknum) {
  ------------------
  |  Branch (8388:9): [True: 917, False: 141k]
  ------------------
 8389|    917|        opj_marker_info_t *new_marker;
 8390|    917|        cstr_index->maxmarknum = (OPJ_UINT32)(100 + (OPJ_FLOAT32)
 8391|    917|                                              cstr_index->maxmarknum);
 8392|    917|        new_marker = (opj_marker_info_t *) opj_realloc(cstr_index->marker,
 8393|    917|                     cstr_index->maxmarknum * sizeof(opj_marker_info_t));
 8394|    917|        if (! new_marker) {
  ------------------
  |  Branch (8394:13): [True: 0, False: 917]
  ------------------
 8395|      0|            opj_free(cstr_index->marker);
 8396|      0|            cstr_index->marker = NULL;
 8397|      0|            cstr_index->maxmarknum = 0;
 8398|      0|            cstr_index->marknum = 0;
 8399|       |            /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add mh marker\n"); */
 8400|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8401|      0|        }
 8402|    917|        cstr_index->marker = new_marker;
 8403|    917|    }
 8404|       |
 8405|       |    /* add the marker */
 8406|   142k|    cstr_index->marker[cstr_index->marknum].type = (OPJ_UINT16)type;
 8407|   142k|    cstr_index->marker[cstr_index->marknum].pos = (OPJ_INT32)pos;
 8408|   142k|    cstr_index->marker[cstr_index->marknum].len = (OPJ_INT32)len;
 8409|   142k|    cstr_index->marknum++;
 8410|   142k|    return OPJ_TRUE;
  ------------------
  |  |  117|   142k|#define OPJ_TRUE 1
  ------------------
 8411|   142k|}
j2k.c:opj_j2k_merge_ppm:
 3990|  7.53k|{
 3991|  7.53k|    OPJ_UINT32 i, l_ppm_data_size, l_N_ppm_remaining;
 3992|       |
 3993|       |    /* preconditions */
 3994|  7.53k|    assert(p_cp != 00);
 3995|  7.53k|    assert(p_manager != 00);
 3996|  7.53k|    assert(p_cp->ppm_buffer == NULL);
 3997|       |
 3998|  7.53k|    if (p_cp->ppm == 0U) {
  ------------------
  |  Branch (3998:9): [True: 7.45k, False: 85]
  ------------------
 3999|  7.45k|        return OPJ_TRUE;
  ------------------
  |  |  117|  7.45k|#define OPJ_TRUE 1
  ------------------
 4000|  7.45k|    }
 4001|       |
 4002|     85|    l_ppm_data_size = 0U;
 4003|     85|    l_N_ppm_remaining = 0U;
 4004|  8.47k|    for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (4004:18): [True: 8.38k, False: 82]
  ------------------
 4005|  8.38k|        if (p_cp->ppm_markers[i].m_data !=
  ------------------
  |  Branch (4005:13): [True: 395, False: 7.99k]
  ------------------
 4006|  8.38k|                NULL) { /* standard doesn't seem to require contiguous Zppm */
 4007|    395|            OPJ_UINT32 l_N_ppm;
 4008|    395|            OPJ_UINT32 l_data_size = p_cp->ppm_markers[i].m_data_size;
 4009|    395|            const OPJ_BYTE* l_data = p_cp->ppm_markers[i].m_data;
 4010|       |
 4011|    395|            if (l_N_ppm_remaining >= l_data_size) {
  ------------------
  |  Branch (4011:17): [True: 157, False: 238]
  ------------------
 4012|    157|                l_N_ppm_remaining -= l_data_size;
 4013|    157|                l_data_size = 0U;
 4014|    238|            } else {
 4015|    238|                l_data += l_N_ppm_remaining;
 4016|    238|                l_data_size -= l_N_ppm_remaining;
 4017|    238|                l_N_ppm_remaining = 0U;
 4018|    238|            }
 4019|       |
 4020|    395|            if (l_data_size > 0U) {
  ------------------
  |  Branch (4020:17): [True: 238, False: 157]
  ------------------
 4021|    695|                do {
 4022|       |                    /* read Nppm */
 4023|    695|                    if (l_data_size < 4U) {
  ------------------
  |  Branch (4023:25): [True: 2, False: 693]
  ------------------
 4024|       |                        /* clean up to be done on l_cp destruction */
 4025|      2|                        opj_event_msg(p_manager, EVT_ERROR, "Not enough bytes to read Nppm\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4026|      2|                        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 4027|      2|                    }
 4028|    693|                    opj_read_bytes(l_data, &l_N_ppm, 4);
  ------------------
  |  |   65|    693|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4029|    693|                    l_data += 4;
 4030|    693|                    l_data_size -= 4;
 4031|       |
 4032|    693|                    if (l_ppm_data_size > UINT_MAX - l_N_ppm) {
  ------------------
  |  Branch (4032:25): [True: 1, False: 692]
  ------------------
 4033|      1|                        opj_event_msg(p_manager, EVT_ERROR, "Too large value for Nppm\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4034|      1|                        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4035|      1|                    }
 4036|    692|                    l_ppm_data_size += l_N_ppm;
 4037|    692|                    if (l_data_size >= l_N_ppm) {
  ------------------
  |  Branch (4037:25): [True: 617, False: 75]
  ------------------
 4038|    617|                        l_data_size -= l_N_ppm;
 4039|    617|                        l_data += l_N_ppm;
 4040|    617|                    } else {
 4041|     75|                        l_N_ppm_remaining = l_N_ppm - l_data_size;
 4042|     75|                        l_data_size = 0U;
 4043|     75|                    }
 4044|    692|                } while (l_data_size > 0U);
  ------------------
  |  Branch (4044:26): [True: 457, False: 235]
  ------------------
 4045|    238|            }
 4046|    395|        }
 4047|  8.38k|    }
 4048|       |
 4049|     82|    if (l_N_ppm_remaining != 0U) {
  ------------------
  |  Branch (4049:9): [True: 52, False: 30]
  ------------------
 4050|       |        /* clean up to be done on l_cp destruction */
 4051|     52|        opj_event_msg(p_manager, EVT_ERROR, "Corrupted PPM markers\n");
  ------------------
  |  |   66|     52|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4052|     52|        return OPJ_FALSE;
  ------------------
  |  |  118|     52|#define OPJ_FALSE 0
  ------------------
 4053|     52|    }
 4054|       |
 4055|     30|    p_cp->ppm_buffer = (OPJ_BYTE *) opj_malloc(l_ppm_data_size);
 4056|     30|    if (p_cp->ppm_buffer == 00) {
  ------------------
  |  Branch (4056:9): [True: 1, False: 29]
  ------------------
 4057|      1|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPM marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4058|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4059|      1|    }
 4060|     29|    p_cp->ppm_len = l_ppm_data_size;
 4061|     29|    l_ppm_data_size = 0U;
 4062|     29|    l_N_ppm_remaining = 0U;
 4063|  3.07k|    for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (4063:18): [True: 3.04k, False: 29]
  ------------------
 4064|  3.04k|        if (p_cp->ppm_markers[i].m_data !=
  ------------------
  |  Branch (4064:13): [True: 181, False: 2.86k]
  ------------------
 4065|  3.04k|                NULL) { /* standard doesn't seem to require contiguous Zppm */
 4066|    181|            OPJ_UINT32 l_N_ppm;
 4067|    181|            OPJ_UINT32 l_data_size = p_cp->ppm_markers[i].m_data_size;
 4068|    181|            const OPJ_BYTE* l_data = p_cp->ppm_markers[i].m_data;
 4069|       |
 4070|    181|            if (l_N_ppm_remaining >= l_data_size) {
  ------------------
  |  Branch (4070:17): [True: 24, False: 157]
  ------------------
 4071|     24|                memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_data_size);
 4072|     24|                l_ppm_data_size += l_data_size;
 4073|     24|                l_N_ppm_remaining -= l_data_size;
 4074|     24|                l_data_size = 0U;
 4075|    157|            } else {
 4076|    157|                memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_N_ppm_remaining);
 4077|    157|                l_ppm_data_size += l_N_ppm_remaining;
 4078|    157|                l_data += l_N_ppm_remaining;
 4079|    157|                l_data_size -= l_N_ppm_remaining;
 4080|    157|                l_N_ppm_remaining = 0U;
 4081|    157|            }
 4082|       |
 4083|    181|            if (l_data_size > 0U) {
  ------------------
  |  Branch (4083:17): [True: 157, False: 24]
  ------------------
 4084|    240|                do {
 4085|       |                    /* read Nppm */
 4086|    240|                    if (l_data_size < 4U) {
  ------------------
  |  Branch (4086:25): [True: 0, False: 240]
  ------------------
 4087|       |                        /* clean up to be done on l_cp destruction */
 4088|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Not enough bytes to read Nppm\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4089|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4090|      0|                    }
 4091|    240|                    opj_read_bytes(l_data, &l_N_ppm, 4);
  ------------------
  |  |   65|    240|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4092|    240|                    l_data += 4;
 4093|    240|                    l_data_size -= 4;
 4094|       |
 4095|    240|                    if (l_data_size >= l_N_ppm) {
  ------------------
  |  Branch (4095:25): [True: 222, False: 18]
  ------------------
 4096|    222|                        memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_N_ppm);
 4097|    222|                        l_ppm_data_size += l_N_ppm;
 4098|    222|                        l_data_size -= l_N_ppm;
 4099|    222|                        l_data += l_N_ppm;
 4100|    222|                    } else {
 4101|     18|                        memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_data_size);
 4102|     18|                        l_ppm_data_size += l_data_size;
 4103|     18|                        l_N_ppm_remaining = l_N_ppm - l_data_size;
 4104|     18|                        l_data_size = 0U;
 4105|     18|                    }
 4106|    240|                } while (l_data_size > 0U);
  ------------------
  |  Branch (4106:26): [True: 83, False: 157]
  ------------------
 4107|    157|            }
 4108|    181|            opj_free(p_cp->ppm_markers[i].m_data);
 4109|    181|            p_cp->ppm_markers[i].m_data = NULL;
 4110|    181|            p_cp->ppm_markers[i].m_data_size = 0U;
 4111|    181|        }
 4112|  3.04k|    }
 4113|       |
 4114|     29|    p_cp->ppm_data = p_cp->ppm_buffer;
 4115|     29|    p_cp->ppm_data_size = p_cp->ppm_len;
 4116|       |
 4117|     29|    p_cp->ppm_markers_count = 0U;
 4118|     29|    opj_free(p_cp->ppm_markers);
 4119|     29|    p_cp->ppm_markers = NULL;
 4120|       |
 4121|     29|    return OPJ_TRUE;
  ------------------
  |  |  117|     29|#define OPJ_TRUE 1
  ------------------
 4122|     29|}
j2k.c:opj_j2k_build_tp_index_from_tlm:
 8883|  7.47k|{
 8884|  7.47k|    opj_j2k_tlm_info_t* l_tlm;
 8885|  7.47k|    OPJ_UINT32 i;
 8886|  7.47k|    OPJ_OFF_T l_cur_offset;
 8887|       |
 8888|  7.47k|    assert(p_j2k->cstr_index->main_head_end > 0);
 8889|  7.47k|    assert(p_j2k->cstr_index->nb_of_tiles > 0);
 8890|  7.47k|    assert(p_j2k->cstr_index->tile_index != NULL);
 8891|       |
 8892|  7.47k|    l_tlm = &(p_j2k->m_specific_param.m_decoder.m_tlm);
 8893|       |
 8894|  7.47k|    if (l_tlm->m_entries_count == 0) {
  ------------------
  |  Branch (8894:9): [True: 7.47k, False: 0]
  ------------------
 8895|  7.47k|        l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|  7.47k|#define OPJ_TRUE 1
  ------------------
 8896|  7.47k|        return;
 8897|  7.47k|    }
 8898|       |
 8899|      0|    if (l_tlm->m_is_invalid) {
  ------------------
  |  Branch (8899:9): [True: 0, False: 0]
  ------------------
 8900|      0|        return;
 8901|      0|    }
 8902|       |
 8903|       |    /* Initial pass to count the number of tile-parts per tile */
 8904|      0|    for (i = 0; i < l_tlm->m_entries_count; ++i) {
  ------------------
  |  Branch (8904:17): [True: 0, False: 0]
  ------------------
 8905|      0|        OPJ_UINT32 l_tile_index_no = l_tlm->m_tile_part_infos[i].m_tile_index;
 8906|      0|        assert(l_tile_index_no < p_j2k->cstr_index->nb_of_tiles);
 8907|      0|        p_j2k->cstr_index->tile_index[l_tile_index_no].tileno = l_tile_index_no;
 8908|      0|        ++p_j2k->cstr_index->tile_index[l_tile_index_no].current_nb_tps;
 8909|      0|    }
 8910|       |
 8911|       |    /* Now check that all tiles have at least one tile-part */
 8912|      0|    for (i = 0; i < p_j2k->cstr_index->nb_of_tiles; ++i) {
  ------------------
  |  Branch (8912:17): [True: 0, False: 0]
  ------------------
 8913|      0|        if (p_j2k->cstr_index->tile_index[i].current_nb_tps == 0) {
  ------------------
  |  Branch (8913:13): [True: 0, False: 0]
  ------------------
 8914|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8915|      0|                          "opj_j2k_build_tp_index_from_tlm(): tile %d has no "
 8916|      0|                          "registered tile-part in TLM marker segments.\n", i);
 8917|      0|            goto error;
 8918|      0|        }
 8919|      0|    }
 8920|       |
 8921|       |    /* Final pass to fill p_j2k->cstr_index */
 8922|      0|    l_cur_offset = p_j2k->cstr_index->main_head_end;
 8923|      0|    for (i = 0; i < l_tlm->m_entries_count; ++i) {
  ------------------
  |  Branch (8923:17): [True: 0, False: 0]
  ------------------
 8924|      0|        OPJ_UINT32 l_tile_index_no = l_tlm->m_tile_part_infos[i].m_tile_index;
 8925|      0|        opj_tile_index_t* l_tile_index = &
 8926|      0|                                         (p_j2k->cstr_index->tile_index[l_tile_index_no]);
 8927|      0|        if (!l_tile_index->tp_index) {
  ------------------
  |  Branch (8927:13): [True: 0, False: 0]
  ------------------
 8928|      0|            l_tile_index->tp_index = (opj_tp_index_t *) opj_calloc(
 8929|      0|                                         l_tile_index->current_nb_tps, sizeof(opj_tp_index_t));
 8930|      0|            if (! l_tile_index->tp_index) {
  ------------------
  |  Branch (8930:17): [True: 0, False: 0]
  ------------------
 8931|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8932|      0|                              "opj_j2k_build_tp_index_from_tlm(): tile index allocation failed\n");
 8933|      0|                goto error;
 8934|      0|            }
 8935|      0|        }
 8936|       |
 8937|      0|        assert(l_tile_index->nb_tps < l_tile_index->current_nb_tps);
 8938|      0|        l_tile_index->tp_index[l_tile_index->nb_tps].start_pos = l_cur_offset;
 8939|       |        /* We don't know how to set the tp_index[].end_header field, but this is not really needed */
 8940|       |        /* If there would be no markers between SOT and SOD, that would be : */
 8941|       |        /* l_tile_index->tp_index[l_tile_index->nb_tps].end_header = l_cur_offset + 12; */
 8942|      0|        l_tile_index->tp_index[l_tile_index->nb_tps].end_pos = l_cur_offset +
 8943|      0|                l_tlm->m_tile_part_infos[i].m_length;
 8944|      0|        ++l_tile_index->nb_tps;
 8945|       |
 8946|      0|        l_cur_offset += l_tlm->m_tile_part_infos[i].m_length;
 8947|      0|    }
 8948|       |
 8949|      0|    return;
 8950|       |
 8951|      0|error:
 8952|      0|    l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 8953|      0|    for (i = 0; i < l_tlm->m_entries_count; ++i) {
  ------------------
  |  Branch (8953:17): [True: 0, False: 0]
  ------------------
 8954|      0|        OPJ_UINT32 l_tile_index = l_tlm->m_tile_part_infos[i].m_tile_index;
 8955|      0|        p_j2k->cstr_index->tile_index[l_tile_index].current_nb_tps = 0;
 8956|      0|        opj_free(p_j2k->cstr_index->tile_index[l_tile_index].tp_index);
 8957|      0|        p_j2k->cstr_index->tile_index[l_tile_index].tp_index = NULL;
 8958|      0|    }
 8959|      0|}
j2k.c:opj_j2k_copy_default_tcp_and_create_tcd:
 9184|  7.47k|{
 9185|  7.47k|    opj_tcp_t * l_tcp = 00;
 9186|  7.47k|    opj_tcp_t * l_default_tcp = 00;
 9187|  7.47k|    OPJ_UINT32 l_nb_tiles;
 9188|  7.47k|    OPJ_UINT32 i, j;
 9189|  7.47k|    opj_tccp_t *l_current_tccp = 00;
 9190|  7.47k|    OPJ_UINT32 l_tccp_size;
 9191|  7.47k|    OPJ_UINT32 l_mct_size;
 9192|  7.47k|    opj_image_t * l_image;
 9193|  7.47k|    OPJ_UINT32 l_mcc_records_size, l_mct_records_size;
 9194|  7.47k|    opj_mct_data_t * l_src_mct_rec, *l_dest_mct_rec;
 9195|  7.47k|    opj_simple_mcc_decorrelation_data_t * l_src_mcc_rec, *l_dest_mcc_rec;
 9196|  7.47k|    OPJ_UINT32 l_offset;
 9197|       |
 9198|       |    /* preconditions */
 9199|  7.47k|    assert(p_j2k != 00);
 9200|  7.47k|    assert(p_stream != 00);
 9201|  7.47k|    assert(p_manager != 00);
 9202|       |
 9203|  7.47k|    OPJ_UNUSED(p_stream);
  ------------------
  |  |  221|  7.47k|#define OPJ_UNUSED(x) (void)x
  ------------------
 9204|       |
 9205|  7.47k|    l_image = p_j2k->m_private_image;
 9206|  7.47k|    l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;
 9207|  7.47k|    l_tcp = p_j2k->m_cp.tcps;
 9208|  7.47k|    l_tccp_size = l_image->numcomps * (OPJ_UINT32)sizeof(opj_tccp_t);
 9209|  7.47k|    l_default_tcp = p_j2k->m_specific_param.m_decoder.m_default_tcp;
 9210|  7.47k|    l_mct_size = l_image->numcomps * l_image->numcomps * (OPJ_UINT32)sizeof(
 9211|  7.47k|                     OPJ_FLOAT32);
 9212|       |
 9213|       |    /* For each tile */
 9214|  17.6M|    for (i = 0; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (9214:17): [True: 17.5M, False: 7.47k]
  ------------------
 9215|       |        /* keep the tile-compo coding parameters pointer of the current tile coding parameters*/
 9216|  17.5M|        l_current_tccp = l_tcp->tccps;
 9217|       |        /*Copy default coding parameters into the current tile coding parameters*/
 9218|  17.5M|        memcpy(l_tcp, l_default_tcp, sizeof(opj_tcp_t));
 9219|       |        /* Initialize some values of the current tile coding parameters*/
 9220|  17.5M|        l_tcp->cod = 0;
 9221|  17.5M|        l_tcp->ppt = 0;
 9222|  17.5M|        l_tcp->ppt_data = 00;
 9223|  17.5M|        l_tcp->m_current_tile_part_number = -1;
 9224|       |        /* Remove memory not owned by this tile in case of early error return. */
 9225|  17.5M|        l_tcp->m_mct_decoding_matrix = 00;
 9226|  17.5M|        l_tcp->m_nb_max_mct_records = 0;
 9227|  17.5M|        l_tcp->m_mct_records = 00;
 9228|  17.5M|        l_tcp->m_nb_max_mcc_records = 0;
 9229|  17.5M|        l_tcp->m_mcc_records = 00;
 9230|       |        /* Reconnect the tile-compo coding parameters pointer to the current tile coding parameters*/
 9231|  17.5M|        l_tcp->tccps = l_current_tccp;
 9232|       |
 9233|       |        /* Get the mct_decoding_matrix of the dflt_tile_cp and copy them into the current tile cp*/
 9234|  17.5M|        if (l_default_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (9234:13): [True: 293, False: 17.5M]
  ------------------
 9235|    293|            l_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(l_mct_size);
 9236|    293|            if (! l_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (9236:17): [True: 0, False: 293]
  ------------------
 9237|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9238|      0|            }
 9239|    293|            memcpy(l_tcp->m_mct_decoding_matrix, l_default_tcp->m_mct_decoding_matrix,
 9240|    293|                   l_mct_size);
 9241|    293|        }
 9242|       |
 9243|       |        /* Get the mct_record of the dflt_tile_cp and copy them into the current tile cp*/
 9244|  17.5M|        l_mct_records_size = l_default_tcp->m_nb_max_mct_records * (OPJ_UINT32)sizeof(
 9245|  17.5M|                                 opj_mct_data_t);
 9246|  17.5M|        l_tcp->m_mct_records = (opj_mct_data_t*)opj_malloc(l_mct_records_size);
 9247|  17.5M|        if (! l_tcp->m_mct_records) {
  ------------------
  |  Branch (9247:13): [True: 0, False: 17.5M]
  ------------------
 9248|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9249|      0|        }
 9250|  17.5M|        memcpy(l_tcp->m_mct_records, l_default_tcp->m_mct_records, l_mct_records_size);
 9251|       |
 9252|       |        /* Copy the mct record data from dflt_tile_cp to the current tile*/
 9253|  17.5M|        l_src_mct_rec = l_default_tcp->m_mct_records;
 9254|  17.5M|        l_dest_mct_rec = l_tcp->m_mct_records;
 9255|       |
 9256|  17.5M|        for (j = 0; j < l_default_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (9256:21): [True: 2.70k, False: 17.5M]
  ------------------
 9257|       |
 9258|  2.70k|            if (l_src_mct_rec->m_data) {
  ------------------
  |  Branch (9258:17): [True: 1.47k, False: 1.23k]
  ------------------
 9259|       |
 9260|  1.47k|                l_dest_mct_rec->m_data = (OPJ_BYTE*) opj_malloc(l_src_mct_rec->m_data_size);
 9261|  1.47k|                if (! l_dest_mct_rec->m_data) {
  ------------------
  |  Branch (9261:21): [True: 0, False: 1.47k]
  ------------------
 9262|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9263|      0|                }
 9264|  1.47k|                memcpy(l_dest_mct_rec->m_data, l_src_mct_rec->m_data,
 9265|  1.47k|                       l_src_mct_rec->m_data_size);
 9266|  1.47k|            }
 9267|       |
 9268|  2.70k|            ++l_src_mct_rec;
 9269|  2.70k|            ++l_dest_mct_rec;
 9270|       |            /* Update with each pass to free exactly what has been allocated on early return. */
 9271|  2.70k|            l_tcp->m_nb_max_mct_records += 1;
 9272|  2.70k|        }
 9273|       |
 9274|       |        /* Get the mcc_record of the dflt_tile_cp and copy them into the current tile cp*/
 9275|  17.5M|        l_mcc_records_size = l_default_tcp->m_nb_max_mcc_records * (OPJ_UINT32)sizeof(
 9276|  17.5M|                                 opj_simple_mcc_decorrelation_data_t);
 9277|  17.5M|        l_tcp->m_mcc_records = (opj_simple_mcc_decorrelation_data_t*) opj_malloc(
 9278|  17.5M|                                   l_mcc_records_size);
 9279|  17.5M|        if (! l_tcp->m_mcc_records) {
  ------------------
  |  Branch (9279:13): [True: 0, False: 17.5M]
  ------------------
 9280|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9281|      0|        }
 9282|  17.5M|        memcpy(l_tcp->m_mcc_records, l_default_tcp->m_mcc_records, l_mcc_records_size);
 9283|  17.5M|        l_tcp->m_nb_max_mcc_records = l_default_tcp->m_nb_max_mcc_records;
 9284|       |
 9285|       |        /* Copy the mcc record data from dflt_tile_cp to the current tile*/
 9286|  17.5M|        l_src_mcc_rec = l_default_tcp->m_mcc_records;
 9287|  17.5M|        l_dest_mcc_rec = l_tcp->m_mcc_records;
 9288|       |
 9289|   193M|        for (j = 0; j < l_default_tcp->m_nb_max_mcc_records; ++j) {
  ------------------
  |  Branch (9289:21): [True: 175M, False: 17.5M]
  ------------------
 9290|       |
 9291|   175M|            if (l_src_mcc_rec->m_decorrelation_array) {
  ------------------
  |  Branch (9291:17): [True: 1.88k, False: 175M]
  ------------------
 9292|  1.88k|                l_offset = (OPJ_UINT32)(l_src_mcc_rec->m_decorrelation_array -
 9293|  1.88k|                                        l_default_tcp->m_mct_records);
 9294|  1.88k|                l_dest_mcc_rec->m_decorrelation_array = l_tcp->m_mct_records + l_offset;
 9295|  1.88k|            }
 9296|       |
 9297|   175M|            if (l_src_mcc_rec->m_offset_array) {
  ------------------
  |  Branch (9297:17): [True: 1.59k, False: 175M]
  ------------------
 9298|  1.59k|                l_offset = (OPJ_UINT32)(l_src_mcc_rec->m_offset_array -
 9299|  1.59k|                                        l_default_tcp->m_mct_records);
 9300|  1.59k|                l_dest_mcc_rec->m_offset_array = l_tcp->m_mct_records + l_offset;
 9301|  1.59k|            }
 9302|       |
 9303|   175M|            ++l_src_mcc_rec;
 9304|   175M|            ++l_dest_mcc_rec;
 9305|   175M|        }
 9306|       |
 9307|       |        /* Copy all the dflt_tile_compo_cp to the current tile cp */
 9308|  17.5M|        memcpy(l_current_tccp, l_default_tcp->tccps, l_tccp_size);
 9309|       |
 9310|       |        /* Move to next tile cp*/
 9311|  17.5M|        ++l_tcp;
 9312|  17.5M|    }
 9313|       |
 9314|       |    /* Create the current tile decoder*/
 9315|  7.47k|    p_j2k->m_tcd = opj_tcd_create(OPJ_TRUE);
  ------------------
  |  |  117|  7.47k|#define OPJ_TRUE 1
  ------------------
 9316|  7.47k|    if (! p_j2k->m_tcd) {
  ------------------
  |  Branch (9316:9): [True: 0, False: 7.47k]
  ------------------
 9317|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9318|      0|    }
 9319|       |
 9320|  7.47k|    if (!opj_tcd_init(p_j2k->m_tcd, l_image, &(p_j2k->m_cp), p_j2k->m_tp)) {
  ------------------
  |  Branch (9320:9): [True: 0, False: 7.47k]
  ------------------
 9321|      0|        opj_tcd_destroy(p_j2k->m_tcd);
 9322|      0|        p_j2k->m_tcd = 00;
 9323|      0|        opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9324|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9325|      0|    }
 9326|       |
 9327|  7.47k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.47k|#define OPJ_TRUE 1
  ------------------
 9328|  7.47k|}
j2k.c:opj_j2k_setup_decoding_validation:
 8555|  8.85k|{
 8556|       |    /* preconditions*/
 8557|  8.85k|    assert(p_j2k != 00);
 8558|  8.85k|    assert(p_manager != 00);
 8559|       |
 8560|  8.85k|    if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list,
  ------------------
  |  Branch (8560:9): [True: 0, False: 8.85k]
  ------------------
 8561|  8.85k|                                           (opj_procedure)opj_j2k_build_decoder, p_manager)) {
 8562|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8563|      0|    }
 8564|  8.85k|    if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list,
  ------------------
  |  Branch (8564:9): [True: 0, False: 8.85k]
  ------------------
 8565|  8.85k|                                           (opj_procedure)opj_j2k_decoding_validation, p_manager)) {
 8566|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8567|      0|    }
 8568|       |
 8569|       |    /* DEVELOPER CORNER, add your custom validation procedure */
 8570|  8.85k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
 8571|  8.85k|}
j2k.c:opj_j2k_build_decoder:
 8775|  8.85k|{
 8776|       |    /* add here initialization of cp
 8777|       |       copy paste of setup_decoder */
 8778|  8.85k|    (void)p_j2k;
 8779|  8.85k|    (void)p_stream;
 8780|  8.85k|    (void)p_manager;
 8781|  8.85k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
 8782|  8.85k|}
j2k.c:opj_j2k_decoding_validation:
 8851|  8.85k|{
 8852|  8.85k|    OPJ_BOOL l_is_valid = OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
 8853|       |
 8854|       |    /* preconditions*/
 8855|  8.85k|    assert(p_j2k != 00);
 8856|  8.85k|    assert(p_stream != 00);
 8857|  8.85k|    assert(p_manager != 00);
 8858|       |
 8859|  8.85k|    OPJ_UNUSED(p_stream);
  ------------------
  |  |  221|  8.85k|#define OPJ_UNUSED(x) (void)x
  ------------------
 8860|  8.85k|    OPJ_UNUSED(p_manager);
  ------------------
  |  |  221|  8.85k|#define OPJ_UNUSED(x) (void)x
  ------------------
 8861|       |
 8862|       |    /* STATE checking */
 8863|       |    /* make sure the state is at 0 */
 8864|       |#ifdef TODO_MSD
 8865|       |    l_is_valid &= (p_j2k->m_specific_param.m_decoder.m_state == J2K_DEC_STATE_NONE);
 8866|       |#endif
 8867|  8.85k|    l_is_valid &= (p_j2k->m_specific_param.m_decoder.m_state == 0x0000);
 8868|       |
 8869|       |    /* POINTER validation */
 8870|       |    /* make sure a p_j2k codec is present */
 8871|       |    /* make sure a procedure list is present */
 8872|  8.85k|    l_is_valid &= (p_j2k->m_procedure_list != 00);
 8873|       |    /* make sure a validation list is present */
 8874|  8.85k|    l_is_valid &= (p_j2k->m_validation_list != 00);
 8875|       |
 8876|       |    /* PARAMETER VALIDATION */
 8877|  8.85k|    return l_is_valid;
 8878|  8.85k|}
j2k.c:opj_j2k_exec:
 9153|  25.1k|{
 9154|  25.1k|    OPJ_BOOL(** l_procedure)(opj_j2k_t *, opj_stream_private_t *,
 9155|  25.1k|                             opj_event_mgr_t *) = 00;
 9156|  25.1k|    OPJ_BOOL l_result = OPJ_TRUE;
  ------------------
  |  |  117|  25.1k|#define OPJ_TRUE 1
  ------------------
 9157|  25.1k|    OPJ_UINT32 l_nb_proc, i;
 9158|       |
 9159|       |    /* preconditions*/
 9160|  25.1k|    assert(p_procedure_list != 00);
 9161|  25.1k|    assert(p_j2k != 00);
 9162|  25.1k|    assert(p_stream != 00);
 9163|  25.1k|    assert(p_manager != 00);
 9164|       |
 9165|  25.1k|    l_nb_proc = opj_procedure_list_get_nb_procedures(p_procedure_list);
 9166|  25.1k|    l_procedure = (OPJ_BOOL(**)(opj_j2k_t *, opj_stream_private_t *,
 9167|  25.1k|                                opj_event_mgr_t *)) opj_procedure_list_get_first_procedure(p_procedure_list);
 9168|       |
 9169|  67.9k|    for (i = 0; i < l_nb_proc; ++i) {
  ------------------
  |  Branch (9169:17): [True: 42.8k, False: 25.1k]
  ------------------
 9170|  42.8k|        l_result = l_result && ((*l_procedure)(p_j2k, p_stream, p_manager));
  ------------------
  |  Branch (9170:20): [True: 41.4k, False: 1.37k]
  |  Branch (9170:32): [True: 34.2k, False: 7.25k]
  ------------------
 9171|  42.8k|        ++l_procedure;
 9172|  42.8k|    }
 9173|       |
 9174|       |    /* and clear the procedure list at the end.*/
 9175|  25.1k|    opj_procedure_list_clear(p_procedure_list);
 9176|  25.1k|    return l_result;
 9177|  25.1k|}
j2k.c:opj_j2k_tcp_destroy:
 9458|  19.1M|{
 9459|  19.1M|    if (p_tcp == 00) {
  ------------------
  |  Branch (9459:9): [True: 0, False: 19.1M]
  ------------------
 9460|      0|        return;
 9461|      0|    }
 9462|       |
 9463|  19.1M|    if (p_tcp->ppt_markers != 00) {
  ------------------
  |  Branch (9463:9): [True: 33, False: 19.1M]
  ------------------
 9464|     33|        OPJ_UINT32 i;
 9465|  1.82k|        for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (9465:22): [True: 1.78k, False: 33]
  ------------------
 9466|  1.78k|            if (p_tcp->ppt_markers[i].m_data != NULL) {
  ------------------
  |  Branch (9466:17): [True: 56, False: 1.73k]
  ------------------
 9467|     56|                opj_free(p_tcp->ppt_markers[i].m_data);
 9468|     56|            }
 9469|  1.78k|        }
 9470|     33|        p_tcp->ppt_markers_count = 0U;
 9471|     33|        opj_free(p_tcp->ppt_markers);
 9472|     33|        p_tcp->ppt_markers = NULL;
 9473|     33|    }
 9474|       |
 9475|  19.1M|    if (p_tcp->ppt_buffer != 00) {
  ------------------
  |  Branch (9475:9): [True: 30, False: 19.1M]
  ------------------
 9476|     30|        opj_free(p_tcp->ppt_buffer);
 9477|     30|        p_tcp->ppt_buffer = 00;
 9478|     30|    }
 9479|       |
 9480|  19.1M|    if (p_tcp->tccps != 00) {
  ------------------
  |  Branch (9480:9): [True: 19.1M, False: 5.55k]
  ------------------
 9481|  19.1M|        opj_free(p_tcp->tccps);
 9482|  19.1M|        p_tcp->tccps = 00;
 9483|  19.1M|    }
 9484|       |
 9485|  19.1M|    if (p_tcp->m_mct_coding_matrix != 00) {
  ------------------
  |  Branch (9485:9): [True: 0, False: 19.1M]
  ------------------
 9486|      0|        opj_free(p_tcp->m_mct_coding_matrix);
 9487|      0|        p_tcp->m_mct_coding_matrix = 00;
 9488|      0|    }
 9489|       |
 9490|  19.1M|    if (p_tcp->m_mct_decoding_matrix != 00) {
  ------------------
  |  Branch (9490:9): [True: 354, False: 19.1M]
  ------------------
 9491|    354|        opj_free(p_tcp->m_mct_decoding_matrix);
 9492|    354|        p_tcp->m_mct_decoding_matrix = 00;
 9493|    354|    }
 9494|       |
 9495|  19.1M|    if (p_tcp->m_mcc_records) {
  ------------------
  |  Branch (9495:9): [True: 17.6M, False: 1.51M]
  ------------------
 9496|  17.6M|        opj_free(p_tcp->m_mcc_records);
 9497|  17.6M|        p_tcp->m_mcc_records = 00;
 9498|  17.6M|        p_tcp->m_nb_max_mcc_records = 0;
 9499|  17.6M|        p_tcp->m_nb_mcc_records = 0;
 9500|  17.6M|    }
 9501|       |
 9502|  19.1M|    if (p_tcp->m_mct_records) {
  ------------------
  |  Branch (9502:9): [True: 17.6M, False: 1.51M]
  ------------------
 9503|  17.6M|        opj_mct_data_t * l_mct_data = p_tcp->m_mct_records;
 9504|  17.6M|        OPJ_UINT32 i;
 9505|       |
 9506|  17.6M|        for (i = 0; i < p_tcp->m_nb_mct_records; ++i) {
  ------------------
  |  Branch (9506:21): [True: 3.47k, False: 17.6M]
  ------------------
 9507|  3.47k|            if (l_mct_data->m_data) {
  ------------------
  |  Branch (9507:17): [True: 1.73k, False: 1.73k]
  ------------------
 9508|  1.73k|                opj_free(l_mct_data->m_data);
 9509|  1.73k|                l_mct_data->m_data = 00;
 9510|  1.73k|            }
 9511|       |
 9512|  3.47k|            ++l_mct_data;
 9513|  3.47k|        }
 9514|       |
 9515|  17.6M|        opj_free(p_tcp->m_mct_records);
 9516|  17.6M|        p_tcp->m_mct_records = 00;
 9517|  17.6M|    }
 9518|       |
 9519|  19.1M|    if (p_tcp->mct_norms != 00) {
  ------------------
  |  Branch (9519:9): [True: 0, False: 19.1M]
  ------------------
 9520|      0|        opj_free(p_tcp->mct_norms);
 9521|      0|        p_tcp->mct_norms = 00;
 9522|      0|    }
 9523|       |
 9524|  19.1M|    opj_j2k_tcp_data_destroy(p_tcp);
 9525|       |
 9526|  19.1M|}
j2k.c:opj_j2k_cp_destroy:
 9538|  8.85k|{
 9539|  8.85k|    OPJ_UINT32 l_nb_tiles;
 9540|  8.85k|    opj_tcp_t * l_current_tile = 00;
 9541|       |
 9542|  8.85k|    if (p_cp == 00) {
  ------------------
  |  Branch (9542:9): [True: 0, False: 8.85k]
  ------------------
 9543|      0|        return;
 9544|      0|    }
 9545|  8.85k|    if (p_cp->tcps != 00) {
  ------------------
  |  Branch (9545:9): [True: 8.51k, False: 339]
  ------------------
 9546|  8.51k|        OPJ_UINT32 i;
 9547|  8.51k|        l_current_tile = p_cp->tcps;
 9548|  8.51k|        l_nb_tiles = p_cp->th * p_cp->tw;
 9549|       |
 9550|  19.1M|        for (i = 0U; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (9550:22): [True: 19.1M, False: 8.51k]
  ------------------
 9551|  19.1M|            opj_j2k_tcp_destroy(l_current_tile);
 9552|  19.1M|            ++l_current_tile;
 9553|  19.1M|        }
 9554|  8.51k|        opj_free(p_cp->tcps);
 9555|  8.51k|        p_cp->tcps = 00;
 9556|  8.51k|    }
 9557|  8.85k|    if (p_cp->ppm_markers != 00) {
  ------------------
  |  Branch (9557:9): [True: 87, False: 8.76k]
  ------------------
 9558|     87|        OPJ_UINT32 i;
 9559|  9.10k|        for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (9559:22): [True: 9.01k, False: 87]
  ------------------
 9560|  9.01k|            if (p_cp->ppm_markers[i].m_data != NULL) {
  ------------------
  |  Branch (9560:17): [True: 348, False: 8.67k]
  ------------------
 9561|    348|                opj_free(p_cp->ppm_markers[i].m_data);
 9562|    348|            }
 9563|  9.01k|        }
 9564|     87|        p_cp->ppm_markers_count = 0U;
 9565|     87|        opj_free(p_cp->ppm_markers);
 9566|     87|        p_cp->ppm_markers = NULL;
 9567|     87|    }
 9568|  8.85k|    opj_free(p_cp->ppm_buffer);
 9569|  8.85k|    p_cp->ppm_buffer = 00;
 9570|  8.85k|    p_cp->ppm_data =
 9571|  8.85k|        NULL; /* ppm_data belongs to the allocated buffer pointed by ppm_buffer */
 9572|  8.85k|    opj_free(p_cp->comment);
 9573|  8.85k|    p_cp->comment = 00;
 9574|  8.85k|    if (! p_cp->m_is_decoder) {
  ------------------
  |  Branch (9574:9): [True: 0, False: 8.85k]
  ------------------
 9575|      0|        opj_free(p_cp->m_specific_param.m_enc.m_matrice);
 9576|      0|        p_cp->m_specific_param.m_enc.m_matrice = 00;
 9577|      0|    }
 9578|  8.85k|}
j2k.c:opj_j2k_get_marker_handler:
 9332|   263k|{
 9333|   263k|    const opj_dec_memory_marker_handler_t *e;
 9334|  5.00M|    for (e = j2k_memory_marker_handler_tab; e->id != 0; ++e) {
  ------------------
  |  Branch (9334:45): [True: 4.88M, False: 119k]
  ------------------
 9335|  4.88M|        if (e->id == p_id) {
  ------------------
  |  Branch (9335:13): [True: 143k, False: 4.74M]
  ------------------
 9336|   143k|            break; /* we find a handler corresponding to the marker ID*/
 9337|   143k|        }
 9338|  4.88M|    }
 9339|   263k|    return e;
 9340|   263k|}
j2k.c:opj_j2k_read_sot:
 4448|  8.10k|{
 4449|  8.10k|    opj_cp_t *l_cp = 00;
 4450|  8.10k|    opj_tcp_t *l_tcp = 00;
 4451|  8.10k|    OPJ_UINT32 l_tot_len, l_num_parts = 0;
 4452|  8.10k|    OPJ_UINT32 l_current_part;
 4453|  8.10k|    OPJ_UINT32 l_tile_x, l_tile_y;
 4454|       |
 4455|       |    /* preconditions */
 4456|       |
 4457|  8.10k|    assert(p_j2k != 00);
 4458|  8.10k|    assert(p_manager != 00);
 4459|       |
 4460|  8.10k|    if (! opj_j2k_get_sot_values(p_header_data, p_header_size,
  ------------------
  |  Branch (4460:9): [True: 7, False: 8.10k]
  ------------------
 4461|  8.10k|                                 &(p_j2k->m_current_tile_number), &l_tot_len, &l_current_part, &l_num_parts,
 4462|  8.10k|                                 p_manager)) {
 4463|      7|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SOT marker\n");
  ------------------
  |  |   66|      7|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4464|      7|        return OPJ_FALSE;
  ------------------
  |  |  118|      7|#define OPJ_FALSE 0
  ------------------
 4465|      7|    }
 4466|       |#ifdef DEBUG_VERBOSE
 4467|       |    fprintf(stderr, "SOT %d %d %d %d\n",
 4468|       |            p_j2k->m_current_tile_number, l_tot_len, l_current_part, l_num_parts);
 4469|       |#endif
 4470|       |
 4471|  8.10k|    l_cp = &(p_j2k->m_cp);
 4472|       |
 4473|       |    /* testcase 2.pdf.SIGFPE.706.1112 */
 4474|  8.10k|    if (p_j2k->m_current_tile_number >= l_cp->tw * l_cp->th) {
  ------------------
  |  Branch (4474:9): [True: 26, False: 8.07k]
  ------------------
 4475|     26|        opj_event_msg(p_manager, EVT_ERROR, "Invalid tile number %d\n",
  ------------------
  |  |   66|     26|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4476|     26|                      p_j2k->m_current_tile_number);
 4477|     26|        return OPJ_FALSE;
  ------------------
  |  |  118|     26|#define OPJ_FALSE 0
  ------------------
 4478|     26|    }
 4479|       |
 4480|  8.07k|    l_tcp = &l_cp->tcps[p_j2k->m_current_tile_number];
 4481|  8.07k|    l_tile_x = p_j2k->m_current_tile_number % l_cp->tw;
 4482|  8.07k|    l_tile_y = p_j2k->m_current_tile_number / l_cp->tw;
 4483|       |
 4484|  8.07k|    if (p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec < 0 ||
  ------------------
  |  Branch (4484:9): [True: 8.07k, False: 0]
  ------------------
 4485|  8.07k|            p_j2k->m_current_tile_number == (OPJ_UINT32)
  ------------------
  |  Branch (4485:13): [True: 0, False: 0]
  ------------------
 4486|  8.07k|            p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec) {
 4487|       |        /* Do only this check if we decode all tile part headers, or if */
 4488|       |        /* we decode one precise tile. Otherwise the m_current_tile_part_number */
 4489|       |        /* might not be valid */
 4490|       |        /* Fixes issue with id_000020,sig_06,src_001958,op_flip4,pos_149 */
 4491|       |        /* of https://github.com/uclouvain/openjpeg/issues/939 */
 4492|       |        /* We must avoid reading twice the same tile part number for a given tile */
 4493|       |        /* so as to avoid various issues, like opj_j2k_merge_ppt being called */
 4494|       |        /* several times. */
 4495|       |        /* ISO 15444-1 A.4.2 Start of tile-part (SOT) mandates that tile parts */
 4496|       |        /* should appear in increasing order. */
 4497|  8.07k|        if (l_tcp->m_current_tile_part_number + 1 != (OPJ_INT32)l_current_part) {
  ------------------
  |  Branch (4497:13): [True: 35, False: 8.04k]
  ------------------
 4498|     35|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     35|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4499|     35|                          "Invalid tile part index for tile number %d. "
 4500|     35|                          "Got %d, expected %d\n",
 4501|     35|                          p_j2k->m_current_tile_number,
 4502|     35|                          l_current_part,
 4503|     35|                          l_tcp->m_current_tile_part_number + 1);
 4504|     35|            return OPJ_FALSE;
  ------------------
  |  |  118|     35|#define OPJ_FALSE 0
  ------------------
 4505|     35|        }
 4506|  8.07k|    }
 4507|       |
 4508|  8.04k|    l_tcp->m_current_tile_part_number = (OPJ_INT32) l_current_part;
 4509|       |
 4510|       |#ifdef USE_JPWL
 4511|       |    if (l_cp->correct) {
 4512|       |
 4513|       |        OPJ_UINT32 tileno = p_j2k->m_current_tile_number;
 4514|       |        static OPJ_UINT32 backup_tileno = 0;
 4515|       |
 4516|       |        /* tileno is negative or larger than the number of tiles!!! */
 4517|       |        if (tileno > (l_cp->tw * l_cp->th)) {
 4518|       |            opj_event_msg(p_manager, EVT_ERROR,
 4519|       |                          "JPWL: bad tile number (%d out of a maximum of %d)\n",
 4520|       |                          tileno, (l_cp->tw * l_cp->th));
 4521|       |            if (!JPWL_ASSUME) {
 4522|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 4523|       |                return OPJ_FALSE;
 4524|       |            }
 4525|       |            /* we try to correct */
 4526|       |            tileno = backup_tileno;
 4527|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 4528|       |                          "- setting tile number to %d\n",
 4529|       |                          tileno);
 4530|       |        }
 4531|       |
 4532|       |        /* keep your private count of tiles */
 4533|       |        backup_tileno++;
 4534|       |    };
 4535|       |#endif /* USE_JPWL */
 4536|       |
 4537|       |    /* look for the tile in the list of already processed tile (in parts). */
 4538|       |    /* Optimization possible here with a more complex data structure and with the removing of tiles */
 4539|       |    /* since the time taken by this function can only grow at the time */
 4540|       |
 4541|       |    /* PSot should be equal to zero or >=14 or <= 2^32-1 */
 4542|  8.04k|    if ((l_tot_len != 0) && (l_tot_len < 14)) {
  ------------------
  |  Branch (4542:9): [True: 1.61k, False: 6.42k]
  |  Branch (4542:29): [True: 4, False: 1.61k]
  ------------------
 4543|      4|        if (l_tot_len ==
  ------------------
  |  Branch (4543:13): [True: 1, False: 3]
  ------------------
 4544|      4|                12) { /* MSD: Special case for the PHR data which are read by kakadu*/
 4545|      1|            opj_event_msg(p_manager, EVT_WARNING, "Empty SOT marker detected: Psot=%d.\n",
  ------------------
  |  |   67|      1|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 4546|      1|                          l_tot_len);
 4547|      3|        } else {
 4548|      3|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4549|      3|                          "Psot value is not correct regards to the JPEG2000 norm: %d.\n", l_tot_len);
 4550|      3|            return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 4551|      3|        }
 4552|      4|    }
 4553|       |
 4554|       |#ifdef USE_JPWL
 4555|       |    if (l_cp->correct) {
 4556|       |
 4557|       |        /* totlen is negative or larger than the bytes left!!! */
 4558|       |        if (/*(l_tot_len < 0) ||*/ (l_tot_len >
 4559|       |                                    p_header_size)) {   /* FIXME it seems correct; for info in V1 -> (p_stream_numbytesleft(p_stream) + 8))) { */
 4560|       |            opj_event_msg(p_manager, EVT_ERROR,
 4561|       |                          "JPWL: bad tile byte size (%d bytes against %d bytes left)\n",
 4562|       |                          l_tot_len,
 4563|       |                          p_header_size);  /* FIXME it seems correct; for info in V1 -> p_stream_numbytesleft(p_stream) + 8); */
 4564|       |            if (!JPWL_ASSUME) {
 4565|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 4566|       |                return OPJ_FALSE;
 4567|       |            }
 4568|       |            /* we try to correct */
 4569|       |            l_tot_len = 0;
 4570|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 4571|       |                          "- setting Psot to %d => assuming it is the last tile\n",
 4572|       |                          l_tot_len);
 4573|       |        }
 4574|       |    };
 4575|       |#endif /* USE_JPWL */
 4576|       |
 4577|       |    /* Ref A.4.2: Psot could be equal zero if it is the last tile-part of the codestream.*/
 4578|  8.03k|    if (!l_tot_len) {
  ------------------
  |  Branch (4578:9): [True: 6.42k, False: 1.61k]
  ------------------
 4579|  6.42k|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|  6.42k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 4580|  6.42k|                      "Psot value of the current tile-part is equal to zero, "
 4581|  6.42k|                      "we assuming it is the last tile-part of the codestream.\n");
 4582|  6.42k|        p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4583|  6.42k|    }
 4584|       |
 4585|  8.03k|    if (l_tcp->m_nb_tile_parts != 0 && l_current_part >= l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4585:9): [True: 35, False: 8.00k]
  |  Branch (4585:40): [True: 0, False: 35]
  ------------------
 4586|       |        /* Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2851 */
 4587|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4588|      0|                      "In SOT marker, TPSot (%d) is not valid regards to the previous "
 4589|      0|                      "number of tile-part (%d), giving up\n", l_current_part,
 4590|      0|                      l_tcp->m_nb_tile_parts);
 4591|      0|        p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4592|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4593|      0|    }
 4594|       |
 4595|  8.03k|    if (l_num_parts !=
  ------------------
  |  Branch (4595:9): [True: 7.91k, False: 119]
  ------------------
 4596|  8.03k|            0) { /* Number of tile-part header is provided by this tile-part header */
 4597|  7.91k|        l_num_parts += p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction;
 4598|       |        /* Useful to manage the case of textGBR.jp2 file because two values of TNSot are allowed: the correct numbers of
 4599|       |         * tile-parts for that tile and zero (A.4.2 of 15444-1 : 2002). */
 4600|  7.91k|        if (l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4600:13): [True: 34, False: 7.88k]
  ------------------
 4601|     34|            if (l_current_part >= l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4601:17): [True: 0, False: 34]
  ------------------
 4602|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4603|      0|                              "In SOT marker, TPSot (%d) is not valid regards to the current "
 4604|      0|                              "number of tile-part (%d), giving up\n", l_current_part,
 4605|      0|                              l_tcp->m_nb_tile_parts);
 4606|      0|                p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4607|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4608|      0|            }
 4609|     34|        }
 4610|  7.91k|        if (l_current_part >= l_num_parts) {
  ------------------
  |  Branch (4610:13): [True: 1, False: 7.91k]
  ------------------
 4611|       |            /* testcase 451.pdf.SIGSEGV.ce9.3723 */
 4612|      1|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4613|      1|                          "In SOT marker, TPSot (%d) is not valid regards to the current "
 4614|      1|                          "number of tile-part (header) (%d), giving up\n", l_current_part, l_num_parts);
 4615|      1|            p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4616|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4617|      1|        }
 4618|  7.91k|        l_tcp->m_nb_tile_parts = l_num_parts;
 4619|  7.91k|    }
 4620|       |
 4621|       |    /* If know the number of tile part header we will check if we didn't read the last*/
 4622|  8.03k|    if (l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4622:9): [True: 7.91k, False: 118]
  ------------------
 4623|  7.91k|        if (l_tcp->m_nb_tile_parts == (l_current_part + 1)) {
  ------------------
  |  Branch (4623:13): [True: 1.25k, False: 6.66k]
  ------------------
 4624|  1.25k|            p_j2k->m_specific_param.m_decoder.m_can_decode =
 4625|  1.25k|                1; /* Process the last tile-part header*/
 4626|  1.25k|        }
 4627|  7.91k|    }
 4628|       |
 4629|  8.03k|    if (!p_j2k->m_specific_param.m_decoder.m_last_tile_part) {
  ------------------
  |  Branch (4629:9): [True: 1.61k, False: 6.42k]
  ------------------
 4630|       |        /* Keep the size of data to skip after this marker */
 4631|  1.61k|        p_j2k->m_specific_param.m_decoder.m_sot_length = l_tot_len -
 4632|  1.61k|                12; /* SOT_marker_size = 12 */
 4633|  6.42k|    } else {
 4634|       |        /* FIXME: need to be computed from the number of bytes remaining in the codestream */
 4635|  6.42k|        p_j2k->m_specific_param.m_decoder.m_sot_length = 0;
 4636|  6.42k|    }
 4637|       |
 4638|  8.03k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPH;
 4639|       |
 4640|       |    /* Check if the current tile is outside the area we want decode or not corresponding to the tile index*/
 4641|  8.03k|    if (p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec == -1) {
  ------------------
  |  Branch (4641:9): [True: 8.03k, False: 0]
  ------------------
 4642|  8.03k|        p_j2k->m_specific_param.m_decoder.m_skip_data =
 4643|  8.03k|            (l_tile_x < p_j2k->m_specific_param.m_decoder.m_start_tile_x)
  ------------------
  |  Branch (4643:13): [True: 0, False: 8.03k]
  ------------------
 4644|  8.03k|            || (l_tile_x >= p_j2k->m_specific_param.m_decoder.m_end_tile_x)
  ------------------
  |  Branch (4644:16): [True: 129, False: 7.90k]
  ------------------
 4645|  8.03k|            || (l_tile_y < p_j2k->m_specific_param.m_decoder.m_start_tile_y)
  ------------------
  |  Branch (4645:16): [True: 0, False: 7.90k]
  ------------------
 4646|  8.03k|            || (l_tile_y >= p_j2k->m_specific_param.m_decoder.m_end_tile_y);
  ------------------
  |  Branch (4646:16): [True: 129, False: 7.77k]
  ------------------
 4647|  8.03k|    } else {
 4648|      0|        assert(p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec >= 0);
 4649|      0|        p_j2k->m_specific_param.m_decoder.m_skip_data =
 4650|      0|            (p_j2k->m_current_tile_number != (OPJ_UINT32)
 4651|      0|             p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec);
 4652|      0|    }
 4653|       |
 4654|       |    /* Index */
 4655|  8.03k|    {
 4656|  8.03k|        assert(p_j2k->cstr_index->tile_index != 00);
 4657|  8.03k|        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tileno =
 4658|  8.03k|            p_j2k->m_current_tile_number;
 4659|  8.03k|        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_tpsno =
 4660|  8.03k|            l_current_part;
 4661|       |
 4662|  8.03k|        if (!p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid &&
  ------------------
  |  Branch (4662:13): [True: 0, False: 8.03k]
  ------------------
 4663|  8.03k|                l_num_parts >
  ------------------
  |  Branch (4663:17): [True: 0, False: 0]
  ------------------
 4664|      0|                p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].nb_tps) {
 4665|      0|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 4666|      0|                          "SOT marker for tile %u declares more tile-parts than found in TLM marker.",
 4667|      0|                          p_j2k->m_current_tile_number);
 4668|      0|            p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 4669|      0|        }
 4670|       |
 4671|  8.03k|        if (!p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid) {
  ------------------
  |  Branch (4671:13): [True: 0, False: 8.03k]
  ------------------
 4672|       |            /* do nothing */
 4673|  8.03k|        } else if (l_num_parts != 0) {
  ------------------
  |  Branch (4673:20): [True: 7.91k, False: 119]
  ------------------
 4674|       |
 4675|  7.91k|            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].nb_tps =
 4676|  7.91k|                l_num_parts;
 4677|  7.91k|            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps =
 4678|  7.91k|                l_num_parts;
 4679|       |
 4680|  7.91k|            if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4680:17): [True: 7.88k, False: 33]
  ------------------
 4681|  7.88k|                p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4682|  7.88k|                    (opj_tp_index_t*)opj_calloc(l_num_parts, sizeof(opj_tp_index_t));
 4683|  7.88k|                if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4683:21): [True: 0, False: 7.88k]
  ------------------
 4684|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4685|      0|                                  "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4686|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4687|      0|                }
 4688|  7.88k|            } else {
 4689|     33|                opj_tp_index_t *new_tp_index = (opj_tp_index_t *) opj_realloc(
 4690|     33|                                                   p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index,
 4691|     33|                                                   l_num_parts * sizeof(opj_tp_index_t));
 4692|     33|                if (! new_tp_index) {
  ------------------
  |  Branch (4692:21): [True: 0, False: 33]
  ------------------
 4693|      0|                    opj_free(p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index);
 4694|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index = NULL;
 4695|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4696|      0|                                  "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4697|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4698|      0|                }
 4699|     33|                p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4700|     33|                    new_tp_index;
 4701|     33|            }
 4702|  7.91k|        } else {
 4703|    119|            /*if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index)*/ {
 4704|       |
 4705|    119|                if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4705:21): [True: 118, False: 1]
  ------------------
 4706|    118|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 10;
 4707|    118|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4708|    118|                        (opj_tp_index_t*)opj_calloc(
 4709|    118|                            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps,
 4710|    118|                            sizeof(opj_tp_index_t));
 4711|    118|                    if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4711:25): [True: 0, False: 118]
  ------------------
 4712|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 0;
 4713|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4714|      0|                                      "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4715|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4716|      0|                    }
 4717|    118|                }
 4718|       |
 4719|    119|                if (l_current_part >=
  ------------------
  |  Branch (4719:21): [True: 0, False: 119]
  ------------------
 4720|    119|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps) {
 4721|      0|                    opj_tp_index_t *new_tp_index;
 4722|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps =
 4723|      0|                        l_current_part + 1;
 4724|      0|                    new_tp_index = (opj_tp_index_t *) opj_realloc(
 4725|      0|                                       p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index,
 4726|      0|                                       p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps *
 4727|      0|                                       sizeof(opj_tp_index_t));
 4728|      0|                    if (! new_tp_index) {
  ------------------
  |  Branch (4728:25): [True: 0, False: 0]
  ------------------
 4729|      0|                        opj_free(p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index);
 4730|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index = NULL;
 4731|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 0;
 4732|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4733|      0|                                      "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4734|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4735|      0|                    }
 4736|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4737|      0|                        new_tp_index;
 4738|      0|                }
 4739|    119|            }
 4740|       |
 4741|    119|        }
 4742|       |
 4743|  8.03k|    }
 4744|       |
 4745|  8.03k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.03k|#define OPJ_TRUE 1
  ------------------
 4746|  8.03k|}
j2k.c:opj_j2k_get_sot_values:
 4422|  11.0k|{
 4423|       |    /* preconditions */
 4424|  11.0k|    assert(p_header_data != 00);
 4425|  11.0k|    assert(p_manager != 00);
 4426|       |
 4427|       |    /* Size of this marker is fixed = 12 (we have already read marker and its size)*/
 4428|  11.0k|    if (p_header_size != 8) {
  ------------------
  |  Branch (4428:9): [True: 7, False: 11.0k]
  ------------------
 4429|      7|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SOT marker\n");
  ------------------
  |  |   66|      7|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4430|      7|        return OPJ_FALSE;
  ------------------
  |  |  118|      7|#define OPJ_FALSE 0
  ------------------
 4431|      7|    }
 4432|       |
 4433|  11.0k|    opj_read_bytes(p_header_data, p_tile_no, 2);    /* Isot */
  ------------------
  |  |   65|  11.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4434|  11.0k|    p_header_data += 2;
 4435|  11.0k|    opj_read_bytes(p_header_data, p_tot_len, 4);    /* Psot */
  ------------------
  |  |   65|  11.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4436|  11.0k|    p_header_data += 4;
 4437|  11.0k|    opj_read_bytes(p_header_data, p_current_part, 1); /* TPsot */
  ------------------
  |  |   65|  11.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4438|  11.0k|    ++p_header_data;
 4439|  11.0k|    opj_read_bytes(p_header_data, p_num_parts, 1);  /* TNsot */
  ------------------
  |  |   65|  11.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4440|  11.0k|    ++p_header_data;
 4441|  11.0k|    return OPJ_TRUE;
  ------------------
  |  |  117|  11.0k|#define OPJ_TRUE 1
  ------------------
 4442|  11.0k|}
j2k.c:opj_j2k_read_cod:
 2670|  9.29k|{
 2671|       |    /* loop */
 2672|  9.29k|    OPJ_UINT32 i;
 2673|  9.29k|    OPJ_UINT32 l_tmp;
 2674|  9.29k|    opj_cp_t *l_cp = 00;
 2675|  9.29k|    opj_tcp_t *l_tcp = 00;
 2676|  9.29k|    opj_image_t *l_image = 00;
 2677|       |
 2678|       |    /* preconditions */
 2679|  9.29k|    assert(p_header_data != 00);
 2680|  9.29k|    assert(p_j2k != 00);
 2681|  9.29k|    assert(p_manager != 00);
 2682|       |
 2683|  9.29k|    l_image = p_j2k->m_private_image;
 2684|  9.29k|    l_cp = &(p_j2k->m_cp);
 2685|       |
 2686|       |    /* If we are in the first tile-part header of the current tile */
 2687|  9.29k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (2687:13): [True: 1, False: 9.29k]
  ------------------
 2688|      1|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 2689|  9.29k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 2690|       |
 2691|       |#if 0
 2692|       |    /* This check was added per https://github.com/uclouvain/openjpeg/commit/daed8cc9195555e101ab708a501af2dfe6d5e001 */
 2693|       |    /* but this is no longer necessary to handle issue476.jp2 */
 2694|       |    /* and this actually cause issues on legit files. See https://github.com/uclouvain/openjpeg/issues/1043 */
 2695|       |    /* Only one COD per tile */
 2696|       |    if (l_tcp->cod) {
 2697|       |        opj_event_msg(p_manager, EVT_ERROR,
 2698|       |                      "COD marker already read. No more than one COD marker per tile.\n");
 2699|       |        return OPJ_FALSE;
 2700|       |    }
 2701|       |#endif
 2702|  9.29k|    l_tcp->cod = 1;
 2703|       |
 2704|       |    /* Make sure room is sufficient */
 2705|  9.29k|    if (p_header_size < 5) {
  ------------------
  |  Branch (2705:9): [True: 2, False: 9.29k]
  ------------------
 2706|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2707|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 2708|      2|    }
 2709|       |
 2710|  9.29k|    opj_read_bytes(p_header_data, &l_tcp->csty, 1);         /* Scod */
  ------------------
  |  |   65|  9.29k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2711|  9.29k|    ++p_header_data;
 2712|       |    /* Make sure we know how to decode this */
 2713|  9.29k|    if ((l_tcp->csty & ~(OPJ_UINT32)(J2K_CP_CSTY_PRT | J2K_CP_CSTY_SOP |
  ------------------
  |  |   54|  9.29k|#define J2K_CP_CSTY_PRT 0x01
  ------------------
                  if ((l_tcp->csty & ~(OPJ_UINT32)(J2K_CP_CSTY_PRT | J2K_CP_CSTY_SOP |
  ------------------
  |  |   55|  9.29k|#define J2K_CP_CSTY_SOP 0x02
  ------------------
  |  Branch (2713:9): [True: 5, False: 9.29k]
  ------------------
 2714|  9.29k|                                     J2K_CP_CSTY_EPH)) != 0U) {
  ------------------
  |  |   56|  9.29k|#define J2K_CP_CSTY_EPH 0x04
  ------------------
 2715|      5|        opj_event_msg(p_manager, EVT_ERROR, "Unknown Scod value in COD marker\n");
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2716|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 2717|      5|    }
 2718|  9.29k|    opj_read_bytes(p_header_data, &l_tmp, 1);                       /* SGcod (A) */
  ------------------
  |  |   65|  9.29k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2719|  9.29k|    ++p_header_data;
 2720|  9.29k|    l_tcp->prg = (OPJ_PROG_ORDER) l_tmp;
 2721|       |    /* Make sure progression order is valid */
 2722|  9.29k|    if (l_tcp->prg > OPJ_CPRL) {
  ------------------
  |  Branch (2722:9): [True: 445, False: 8.84k]
  ------------------
 2723|    445|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    445|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2724|    445|                      "Unknown progression order in COD marker\n");
 2725|    445|        l_tcp->prg = OPJ_PROG_UNKNOWN;
 2726|    445|    }
 2727|  9.29k|    opj_read_bytes(p_header_data, &l_tcp->numlayers, 2);    /* SGcod (B) */
  ------------------
  |  |   65|  9.29k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2728|  9.29k|    p_header_data += 2;
 2729|       |
 2730|  9.29k|    if ((l_tcp->numlayers < 1U) || (l_tcp->numlayers > 65535U)) {
  ------------------
  |  Branch (2730:9): [True: 2, False: 9.29k]
  |  Branch (2730:36): [True: 0, False: 9.29k]
  ------------------
 2731|      2|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2732|      2|                      "Invalid number of layers in COD marker : %d not in range [1-65535]\n",
 2733|      2|                      l_tcp->numlayers);
 2734|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 2735|      2|    }
 2736|       |
 2737|       |    /* If user didn't set a number layer to decode take the max specify in the codestream. */
 2738|  9.29k|    if (l_cp->m_specific_param.m_dec.m_layer) {
  ------------------
  |  Branch (2738:9): [True: 0, False: 9.29k]
  ------------------
 2739|      0|        l_tcp->num_layers_to_decode = l_cp->m_specific_param.m_dec.m_layer;
 2740|  9.29k|    } else {
 2741|  9.29k|        l_tcp->num_layers_to_decode = l_tcp->numlayers;
 2742|  9.29k|    }
 2743|       |
 2744|  9.29k|    opj_read_bytes(p_header_data, &l_tcp->mct, 1);          /* SGcod (C) */
  ------------------
  |  |   65|  9.29k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2745|  9.29k|    ++p_header_data;
 2746|       |
 2747|  9.29k|    if (l_tcp->mct > 1) {
  ------------------
  |  Branch (2747:9): [True: 10, False: 9.28k]
  ------------------
 2748|     10|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2749|     10|                      "Invalid multiple component transformation\n");
 2750|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 2751|     10|    }
 2752|       |
 2753|  9.28k|    p_header_size -= 5;
 2754|  45.7k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2754:17): [True: 36.4k, False: 9.28k]
  ------------------
 2755|  36.4k|        l_tcp->tccps[i].csty = l_tcp->csty & J2K_CCP_CSTY_PRT;
  ------------------
  |  |   57|  36.4k|#define J2K_CCP_CSTY_PRT 0x01
  ------------------
 2756|  36.4k|    }
 2757|       |
 2758|  9.28k|    if (! opj_j2k_read_SPCod_SPCoc(p_j2k, 0, p_header_data, &p_header_size,
  ------------------
  |  Branch (2758:9): [True: 28, False: 9.25k]
  ------------------
 2759|  9.28k|                                   p_manager)) {
 2760|     28|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|     28|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2761|     28|        return OPJ_FALSE;
  ------------------
  |  |  118|     28|#define OPJ_FALSE 0
  ------------------
 2762|     28|    }
 2763|       |
 2764|  9.25k|    if (p_header_size != 0) {
  ------------------
  |  Branch (2764:9): [True: 3, False: 9.24k]
  ------------------
 2765|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2766|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2767|      3|    }
 2768|       |
 2769|       |    /* Apply the coding style to other components of the current tile or the m_default_tcp*/
 2770|  9.24k|    opj_j2k_copy_tile_component_parameters(p_j2k);
 2771|       |
 2772|       |    /* Index */
 2773|       |#ifdef WIP_REMOVE_MSD
 2774|       |    if (p_j2k->cstr_info) {
 2775|       |        /*opj_codestream_info_t *l_cstr_info = p_j2k->cstr_info;*/
 2776|       |        p_j2k->cstr_info->prog = l_tcp->prg;
 2777|       |        p_j2k->cstr_info->numlayers = l_tcp->numlayers;
 2778|       |        p_j2k->cstr_info->numdecompos = (OPJ_INT32*) opj_malloc(
 2779|       |                                            l_image->numcomps * sizeof(OPJ_UINT32));
 2780|       |        if (!p_j2k->cstr_info->numdecompos) {
 2781|       |            return OPJ_FALSE;
 2782|       |        }
 2783|       |        for (i = 0; i < l_image->numcomps; ++i) {
 2784|       |            p_j2k->cstr_info->numdecompos[i] = l_tcp->tccps[i].numresolutions - 1;
 2785|       |        }
 2786|       |    }
 2787|       |#endif
 2788|       |
 2789|  9.24k|    return OPJ_TRUE;
  ------------------
  |  |  117|  9.24k|#define OPJ_TRUE 1
  ------------------
 2790|  9.25k|}
j2k.c:opj_j2k_read_SPCod_SPCoc:
10914|  9.52k|{
10915|  9.52k|    OPJ_UINT32 i, l_tmp;
10916|  9.52k|    opj_cp_t *l_cp = NULL;
10917|  9.52k|    opj_tcp_t *l_tcp = NULL;
10918|  9.52k|    opj_tccp_t *l_tccp = NULL;
10919|  9.52k|    OPJ_BYTE * l_current_ptr = NULL;
10920|       |
10921|       |    /* preconditions */
10922|  9.52k|    assert(p_j2k != 00);
10923|  9.52k|    assert(p_manager != 00);
10924|  9.52k|    assert(p_header_data != 00);
10925|       |
10926|  9.52k|    l_cp = &(p_j2k->m_cp);
10927|  9.52k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (10927:13): [True: 22, False: 9.50k]
  ------------------
10928|     22|            &l_cp->tcps[p_j2k->m_current_tile_number] :
10929|  9.52k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
10930|       |
10931|       |    /* precondition again */
10932|  9.52k|    assert(compno < p_j2k->m_private_image->numcomps);
10933|       |
10934|  9.52k|    l_tccp = &l_tcp->tccps[compno];
10935|  9.52k|    l_current_ptr = p_header_data;
10936|       |
10937|       |    /* make sure room is sufficient */
10938|  9.52k|    if (*p_header_size < 5) {
  ------------------
  |  Branch (10938:9): [True: 6, False: 9.51k]
  ------------------
10939|      6|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc element\n");
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10940|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
10941|      6|    }
10942|       |
10943|       |    /* SPcod (D) / SPcoc (A) */
10944|  9.51k|    opj_read_bytes(l_current_ptr, &l_tccp->numresolutions, 1);
  ------------------
  |  |   65|  9.51k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10945|  9.51k|    ++l_tccp->numresolutions;  /* tccp->numresolutions = read() + 1 */
10946|  9.51k|    if (l_tccp->numresolutions > OPJ_J2K_MAXRLVLS) {
  ------------------
  |  |  154|  9.51k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  ------------------
  |  Branch (10946:9): [True: 6, False: 9.51k]
  ------------------
10947|      6|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10948|      6|                      "Invalid value for numresolutions : %d, max value is set in openjpeg.h at %d\n",
10949|      6|                      l_tccp->numresolutions, OPJ_J2K_MAXRLVLS);
  ------------------
  |  |  154|      6|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  ------------------
10950|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
10951|      6|    }
10952|  9.51k|    ++l_current_ptr;
10953|       |
10954|       |    /* If user wants to remove more resolutions than the codestream contains, return error */
10955|  9.51k|    if (l_cp->m_specific_param.m_dec.m_reduce >= l_tccp->numresolutions) {
  ------------------
  |  Branch (10955:9): [True: 0, False: 9.51k]
  ------------------
10956|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10957|      0|                      "Error decoding component %d.\nThe number of resolutions "
10958|      0|                      "to remove (%d) is greater or equal than the number "
10959|      0|                      "of resolutions of this component (%d)\nModify the cp_reduce parameter.\n\n",
10960|      0|                      compno, l_cp->m_specific_param.m_dec.m_reduce, l_tccp->numresolutions);
10961|      0|        p_j2k->m_specific_param.m_decoder.m_state |=
10962|      0|            0x8000;/* FIXME J2K_DEC_STATE_ERR;*/
10963|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10964|      0|    }
10965|       |
10966|       |    /* SPcod (E) / SPcoc (B) */
10967|  9.51k|    opj_read_bytes(l_current_ptr, &l_tccp->cblkw, 1);
  ------------------
  |  |   65|  9.51k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10968|  9.51k|    ++l_current_ptr;
10969|  9.51k|    l_tccp->cblkw += 2;
10970|       |
10971|       |    /* SPcod (F) / SPcoc (C) */
10972|  9.51k|    opj_read_bytes(l_current_ptr, &l_tccp->cblkh, 1);
  ------------------
  |  |   65|  9.51k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10973|  9.51k|    ++l_current_ptr;
10974|  9.51k|    l_tccp->cblkh += 2;
10975|       |
10976|  9.51k|    if ((l_tccp->cblkw > 10) || (l_tccp->cblkh > 10) ||
  ------------------
  |  Branch (10976:9): [True: 6, False: 9.50k]
  |  Branch (10976:33): [True: 3, False: 9.50k]
  ------------------
10977|  9.51k|            ((l_tccp->cblkw + l_tccp->cblkh) > 12)) {
  ------------------
  |  Branch (10977:13): [True: 1, False: 9.50k]
  ------------------
10978|     10|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10979|     10|                      "Error reading SPCod SPCoc element, Invalid cblkw/cblkh combination\n");
10980|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
10981|     10|    }
10982|       |
10983|       |    /* SPcod (G) / SPcoc (D) */
10984|  9.50k|    opj_read_bytes(l_current_ptr, &l_tccp->cblksty, 1);
  ------------------
  |  |   65|  9.50k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10985|  9.50k|    ++l_current_ptr;
10986|  9.50k|    if ((l_tccp->cblksty & J2K_CCP_CBLKSTY_HTMIXED) != 0) {
  ------------------
  |  |   65|  9.50k|#define J2K_CCP_CBLKSTY_HTMIXED 0x80  /**< MIXED mode HT codeblocks */
  ------------------
  |  Branch (10986:9): [True: 2, False: 9.49k]
  ------------------
10987|       |        /* We do not support HT mixed mode yet.  For conformance, it should be supported.*/
10988|      2|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10989|      2|                      "Error reading SPCod SPCoc element. Unsupported Mixed HT code-block style found\n");
10990|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
10991|      2|    }
10992|       |
10993|       |    /* SPcod (H) / SPcoc (E) */
10994|  9.49k|    opj_read_bytes(l_current_ptr, &l_tccp->qmfbid, 1);
  ------------------
  |  |   65|  9.49k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10995|  9.49k|    ++l_current_ptr;
10996|       |
10997|  9.49k|    if (l_tccp->qmfbid > 1) {
  ------------------
  |  Branch (10997:9): [True: 6, False: 9.49k]
  ------------------
10998|      6|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10999|      6|                      "Error reading SPCod SPCoc element, Invalid transformation found\n");
11000|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
11001|      6|    }
11002|       |
11003|  9.49k|    *p_header_size = *p_header_size - 5;
11004|       |
11005|       |    /* use custom precinct size ? */
11006|  9.49k|    if (l_tccp->csty & J2K_CCP_CSTY_PRT) {
  ------------------
  |  |   57|  9.49k|#define J2K_CCP_CSTY_PRT 0x01
  ------------------
  |  Branch (11006:9): [True: 5.20k, False: 4.29k]
  ------------------
11007|  5.20k|        if (*p_header_size < l_tccp->numresolutions) {
  ------------------
  |  Branch (11007:13): [True: 2, False: 5.20k]
  ------------------
11008|      2|            opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc element\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11009|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
11010|      2|        }
11011|       |
11012|       |        /* SPcod (I_i) / SPcoc (F_i) */
11013|  11.5k|        for (i = 0; i < l_tccp->numresolutions; ++i) {
  ------------------
  |  Branch (11013:21): [True: 6.39k, False: 5.19k]
  ------------------
11014|  6.39k|            opj_read_bytes(l_current_ptr, &l_tmp, 1);
  ------------------
  |  |   65|  6.39k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11015|  6.39k|            ++l_current_ptr;
11016|       |            /* Precinct exponent 0 is only allowed for lowest resolution level (Table A.21) */
11017|  6.39k|            if ((i != 0) && (((l_tmp & 0xf) == 0) || ((l_tmp >> 4) == 0))) {
  ------------------
  |  Branch (11017:17): [True: 1.19k, False: 5.20k]
  |  Branch (11017:30): [True: 5, False: 1.19k]
  |  Branch (11017:54): [True: 3, False: 1.18k]
  ------------------
11018|      8|                opj_event_msg(p_manager, EVT_ERROR, "Invalid precinct size\n");
  ------------------
  |  |   66|      8|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11019|      8|                return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
11020|      8|            }
11021|  6.38k|            l_tccp->prcw[i] = l_tmp & 0xf;
11022|  6.38k|            l_tccp->prch[i] = l_tmp >> 4;
11023|  6.38k|        }
11024|       |
11025|  5.19k|        *p_header_size = *p_header_size - l_tccp->numresolutions;
11026|  5.19k|    } else {
11027|       |        /* set default size for the precinct width and height */
11028|  31.2k|        for (i = 0; i < l_tccp->numresolutions; ++i) {
  ------------------
  |  Branch (11028:21): [True: 26.9k, False: 4.29k]
  ------------------
11029|  26.9k|            l_tccp->prcw[i] = 15;
11030|  26.9k|            l_tccp->prch[i] = 15;
11031|  26.9k|        }
11032|  4.29k|    }
11033|       |
11034|       |#ifdef WIP_REMOVE_MSD
11035|       |    /* INDEX >> */
11036|       |    if (p_j2k->cstr_info && compno == 0) {
11037|       |        OPJ_UINT32 l_data_size = l_tccp->numresolutions * sizeof(OPJ_UINT32);
11038|       |
11039|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblkh =
11040|       |            l_tccp->cblkh;
11041|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblkw =
11042|       |            l_tccp->cblkw;
11043|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].numresolutions
11044|       |            = l_tccp->numresolutions;
11045|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblksty =
11046|       |            l_tccp->cblksty;
11047|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].qmfbid =
11048|       |            l_tccp->qmfbid;
11049|       |
11050|       |        memcpy(p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].pdx, l_tccp->prcw,
11051|       |               l_data_size);
11052|       |        memcpy(p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].pdy, l_tccp->prch,
11053|       |               l_data_size);
11054|       |    }
11055|       |    /* << INDEX */
11056|       |#endif
11057|       |
11058|  9.48k|    return OPJ_TRUE;
  ------------------
  |  |  117|  9.48k|#define OPJ_TRUE 1
  ------------------
11059|  9.49k|}
j2k.c:opj_j2k_copy_tile_component_parameters:
11062|  9.24k|{
11063|       |    /* loop */
11064|  9.24k|    OPJ_UINT32 i;
11065|  9.24k|    opj_cp_t *l_cp = NULL;
11066|  9.24k|    opj_tcp_t *l_tcp = NULL;
11067|  9.24k|    opj_tccp_t *l_ref_tccp = NULL, *l_copied_tccp = NULL;
11068|  9.24k|    OPJ_UINT32 l_prc_size;
11069|       |
11070|       |    /* preconditions */
11071|  9.24k|    assert(p_j2k != 00);
11072|       |
11073|  9.24k|    l_cp = &(p_j2k->m_cp);
11074|  9.24k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (11074:13): [True: 1, False: 9.24k]
  ------------------
11075|  9.24k|            ?
11076|      1|            &l_cp->tcps[p_j2k->m_current_tile_number] :
11077|  9.24k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
11078|       |
11079|  9.24k|    l_ref_tccp = &l_tcp->tccps[0];
11080|  9.24k|    l_copied_tccp = l_ref_tccp + 1;
11081|  9.24k|    l_prc_size = l_ref_tccp->numresolutions * (OPJ_UINT32)sizeof(OPJ_UINT32);
11082|       |
11083|  36.3k|    for (i = 1; i < p_j2k->m_private_image->numcomps; ++i) {
  ------------------
  |  Branch (11083:17): [True: 27.1k, False: 9.24k]
  ------------------
11084|  27.1k|        l_copied_tccp->numresolutions = l_ref_tccp->numresolutions;
11085|  27.1k|        l_copied_tccp->cblkw = l_ref_tccp->cblkw;
11086|  27.1k|        l_copied_tccp->cblkh = l_ref_tccp->cblkh;
11087|  27.1k|        l_copied_tccp->cblksty = l_ref_tccp->cblksty;
11088|  27.1k|        l_copied_tccp->qmfbid = l_ref_tccp->qmfbid;
11089|  27.1k|        memcpy(l_copied_tccp->prcw, l_ref_tccp->prcw, l_prc_size);
11090|  27.1k|        memcpy(l_copied_tccp->prch, l_ref_tccp->prch, l_prc_size);
11091|  27.1k|        ++l_copied_tccp;
11092|  27.1k|    }
11093|  9.24k|}
j2k.c:opj_j2k_read_coc:
 2947|    253|{
 2948|    253|    opj_cp_t *l_cp = NULL;
 2949|    253|    opj_tcp_t *l_tcp = NULL;
 2950|    253|    opj_image_t *l_image = NULL;
 2951|    253|    OPJ_UINT32 l_comp_room;
 2952|    253|    OPJ_UINT32 l_comp_no;
 2953|       |
 2954|       |    /* preconditions */
 2955|    253|    assert(p_header_data != 00);
 2956|    253|    assert(p_j2k != 00);
 2957|    253|    assert(p_manager != 00);
 2958|       |
 2959|    253|    l_cp = &(p_j2k->m_cp);
 2960|    253|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (2960:13): [True: 23, False: 230]
  ------------------
 2961|    253|            ?
 2962|     23|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 2963|    253|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 2964|    253|    l_image = p_j2k->m_private_image;
 2965|       |
 2966|    253|    l_comp_room = l_image->numcomps <= 256 ? 1 : 2;
  ------------------
  |  Branch (2966:19): [True: 108, False: 145]
  ------------------
 2967|       |
 2968|       |    /* make sure room is sufficient*/
 2969|    253|    if (p_header_size < l_comp_room + 1) {
  ------------------
  |  Branch (2969:9): [True: 3, False: 250]
  ------------------
 2970|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2971|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2972|      3|    }
 2973|    250|    p_header_size -= l_comp_room + 1;
 2974|       |
 2975|    250|    opj_read_bytes(p_header_data, &l_comp_no,
  ------------------
  |  |   65|    250|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2976|    250|                   l_comp_room);                 /* Ccoc */
 2977|    250|    p_header_data += l_comp_room;
 2978|    250|    if (l_comp_no >= l_image->numcomps) {
  ------------------
  |  Branch (2978:9): [True: 7, False: 243]
  ------------------
 2979|      7|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      7|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2980|      7|                      "Error reading COC marker (bad number of components)\n");
 2981|      7|        return OPJ_FALSE;
  ------------------
  |  |  118|      7|#define OPJ_FALSE 0
  ------------------
 2982|      7|    }
 2983|       |
 2984|    243|    opj_read_bytes(p_header_data, &l_tcp->tccps[l_comp_no].csty,
  ------------------
  |  |   65|    243|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2985|    243|                   1);                  /* Scoc */
 2986|    243|    ++p_header_data ;
 2987|       |
 2988|    243|    if (! opj_j2k_read_SPCod_SPCoc(p_j2k, l_comp_no, p_header_data, &p_header_size,
  ------------------
  |  Branch (2988:9): [True: 12, False: 231]
  ------------------
 2989|    243|                                   p_manager)) {
 2990|     12|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|     12|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2991|     12|        return OPJ_FALSE;
  ------------------
  |  |  118|     12|#define OPJ_FALSE 0
  ------------------
 2992|     12|    }
 2993|       |
 2994|    231|    if (p_header_size != 0) {
  ------------------
  |  Branch (2994:9): [True: 1, False: 230]
  ------------------
 2995|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2996|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 2997|      1|    }
 2998|    230|    return OPJ_TRUE;
  ------------------
  |  |  117|    230|#define OPJ_TRUE 1
  ------------------
 2999|    231|}
j2k.c:opj_j2k_read_rgn:
 5240|    595|{
 5241|    595|    OPJ_UINT32 l_nb_comp;
 5242|    595|    opj_image_t * l_image = 00;
 5243|       |
 5244|    595|    opj_cp_t *l_cp = 00;
 5245|    595|    opj_tcp_t *l_tcp = 00;
 5246|    595|    OPJ_UINT32 l_comp_room, l_comp_no, l_roi_sty;
 5247|       |
 5248|       |    /* preconditions*/
 5249|    595|    assert(p_header_data != 00);
 5250|    595|    assert(p_j2k != 00);
 5251|    595|    assert(p_manager != 00);
 5252|       |
 5253|    595|    l_image = p_j2k->m_private_image;
 5254|    595|    l_nb_comp = l_image->numcomps;
 5255|       |
 5256|    595|    if (l_nb_comp <= 256) {
  ------------------
  |  Branch (5256:9): [True: 272, False: 323]
  ------------------
 5257|    272|        l_comp_room = 1;
 5258|    323|    } else {
 5259|    323|        l_comp_room = 2;
 5260|    323|    }
 5261|       |
 5262|    595|    if (p_header_size != 2 + l_comp_room) {
  ------------------
  |  Branch (5262:9): [True: 3, False: 592]
  ------------------
 5263|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading RGN marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5264|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 5265|      3|    }
 5266|       |
 5267|    592|    l_cp = &(p_j2k->m_cp);
 5268|    592|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (5268:13): [True: 44, False: 548]
  ------------------
 5269|     44|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 5270|    592|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 5271|       |
 5272|    592|    opj_read_bytes(p_header_data, &l_comp_no, l_comp_room);         /* Crgn */
  ------------------
  |  |   65|    592|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5273|    592|    p_header_data += l_comp_room;
 5274|    592|    opj_read_bytes(p_header_data, &l_roi_sty,
  ------------------
  |  |   65|    592|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5275|    592|                   1);                                     /* Srgn */
 5276|    592|    ++p_header_data;
 5277|       |
 5278|       |#ifdef USE_JPWL
 5279|       |    if (l_cp->correct) {
 5280|       |        /* totlen is negative or larger than the bytes left!!! */
 5281|       |        if (l_comp_room >= l_nb_comp) {
 5282|       |            opj_event_msg(p_manager, EVT_ERROR,
 5283|       |                          "JPWL: bad component number in RGN (%d when there are only %d)\n",
 5284|       |                          l_comp_room, l_nb_comp);
 5285|       |            if (!JPWL_ASSUME) {
 5286|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 5287|       |                return OPJ_FALSE;
 5288|       |            }
 5289|       |        }
 5290|       |    };
 5291|       |#endif /* USE_JPWL */
 5292|       |
 5293|       |    /* testcase 3635.pdf.asan.77.2930 */
 5294|    592|    if (l_comp_no >= l_nb_comp) {
  ------------------
  |  Branch (5294:9): [True: 5, False: 587]
  ------------------
 5295|      5|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5296|      5|                      "bad component number in RGN (%d when there are only %d)\n",
 5297|      5|                      l_comp_no, l_nb_comp);
 5298|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 5299|      5|    }
 5300|       |
 5301|    587|    opj_read_bytes(p_header_data,
  ------------------
  |  |   65|    587|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5302|    587|                   (OPJ_UINT32 *)(&(l_tcp->tccps[l_comp_no].roishift)), 1);  /* SPrgn */
 5303|    587|    ++p_header_data;
 5304|       |
 5305|    587|    return OPJ_TRUE;
  ------------------
  |  |  117|    587|#define OPJ_TRUE 1
  ------------------
 5306|       |
 5307|    592|}
j2k.c:opj_j2k_read_qcd:
 3074|  9.89k|{
 3075|       |    /* preconditions */
 3076|  9.89k|    assert(p_header_data != 00);
 3077|  9.89k|    assert(p_j2k != 00);
 3078|  9.89k|    assert(p_manager != 00);
 3079|       |
 3080|  9.89k|    if (! opj_j2k_read_SQcd_SQcc(p_j2k, 0, p_header_data, &p_header_size,
  ------------------
  |  Branch (3080:9): [True: 3, False: 9.89k]
  ------------------
 3081|  9.89k|                                 p_manager)) {
 3082|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCD marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3083|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 3084|      3|    }
 3085|       |
 3086|  9.89k|    if (p_header_size != 0) {
  ------------------
  |  Branch (3086:9): [True: 14, False: 9.87k]
  ------------------
 3087|     14|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCD marker\n");
  ------------------
  |  |   66|     14|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3088|     14|        return OPJ_FALSE;
  ------------------
  |  |  118|     14|#define OPJ_FALSE 0
  ------------------
 3089|     14|    }
 3090|       |
 3091|       |    /* Apply the quantization parameters to other components of the current tile or the m_default_tcp */
 3092|  9.87k|    opj_j2k_copy_tile_quantization_parameters(p_j2k);
 3093|       |
 3094|  9.87k|    return OPJ_TRUE;
  ------------------
  |  |  117|  9.87k|#define OPJ_TRUE 1
  ------------------
 3095|  9.89k|}
j2k.c:opj_j2k_read_SQcd_SQcc:
11255|  10.9k|{
11256|       |    /* loop*/
11257|  10.9k|    OPJ_UINT32 l_band_no;
11258|  10.9k|    opj_cp_t *l_cp = 00;
11259|  10.9k|    opj_tcp_t *l_tcp = 00;
11260|  10.9k|    opj_tccp_t *l_tccp = 00;
11261|  10.9k|    OPJ_BYTE * l_current_ptr = 00;
11262|  10.9k|    OPJ_UINT32 l_tmp, l_num_band;
11263|       |
11264|       |    /* preconditions*/
11265|  10.9k|    assert(p_j2k != 00);
11266|  10.9k|    assert(p_manager != 00);
11267|  10.9k|    assert(p_header_data != 00);
11268|       |
11269|  10.9k|    l_cp = &(p_j2k->m_cp);
11270|       |    /* come from tile part header or main header ?*/
11271|  10.9k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (11271:13): [True: 74, False: 10.8k]
  ------------------
11272|  10.9k|            ?
11273|     74|            &l_cp->tcps[p_j2k->m_current_tile_number] :
11274|  10.9k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
11275|       |
11276|       |    /* precondition again*/
11277|  10.9k|    assert(p_comp_no <  p_j2k->m_private_image->numcomps);
11278|       |
11279|  10.9k|    l_tccp = &l_tcp->tccps[p_comp_no];
11280|  10.9k|    l_current_ptr = p_header_data;
11281|       |
11282|  10.9k|    if (*p_header_size < 1) {
  ------------------
  |  Branch (11282:9): [True: 3, False: 10.9k]
  ------------------
11283|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SQcd or SQcc element\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11284|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
11285|      3|    }
11286|  10.9k|    *p_header_size -= 1;
11287|       |
11288|  10.9k|    opj_read_bytes(l_current_ptr, &l_tmp, 1);                       /* Sqcx */
  ------------------
  |  |   65|  10.9k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11289|  10.9k|    ++l_current_ptr;
11290|       |
11291|  10.9k|    l_tccp->qntsty = l_tmp & 0x1f;
11292|  10.9k|    l_tccp->numgbits = l_tmp >> 5;
11293|  10.9k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
  ------------------
  |  |   67|  10.9k|#define J2K_CCP_QNTSTY_SIQNT 1
  ------------------
  |  Branch (11293:9): [True: 762, False: 10.2k]
  ------------------
11294|    762|        l_num_band = 1;
11295|  10.2k|    } else {
11296|  10.2k|        l_num_band = (l_tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) ?
  ------------------
  |  |   66|  10.2k|#define J2K_CCP_QNTSTY_NOQNT 0
  ------------------
  |  Branch (11296:22): [True: 8.99k, False: 1.21k]
  ------------------
11297|  8.99k|                     (*p_header_size) :
11298|  10.2k|                     (*p_header_size) / 2;
11299|       |
11300|  10.2k|        if (l_num_band > OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  155|  10.2k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|  10.2k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11300:13): [True: 106, False: 10.1k]
  ------------------
11301|    106|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    106|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11302|    106|                          "While reading CCP_QNTSTY element inside QCD or QCC marker segment, "
11303|    106|                          "number of subbands (%d) is greater to OPJ_J2K_MAXBANDS (%d). So we limit the number of elements stored to "
11304|    106|                          "OPJ_J2K_MAXBANDS (%d) and skip the rest. \n", l_num_band, OPJ_J2K_MAXBANDS,
  ------------------
  |  |  155|    106|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|    106|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11305|    106|                          OPJ_J2K_MAXBANDS);
  ------------------
  |  |  155|    106|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|    106|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11306|       |            /*return OPJ_FALSE;*/
11307|    106|        }
11308|  10.2k|    }
11309|       |
11310|       |#ifdef USE_JPWL
11311|       |    if (l_cp->correct) {
11312|       |
11313|       |        /* if JPWL is on, we check whether there are too many subbands */
11314|       |        if (/*(l_num_band < 0) ||*/ (l_num_band >= OPJ_J2K_MAXBANDS)) {
11315|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
11316|       |                          "JPWL: bad number of subbands in Sqcx (%d)\n",
11317|       |                          l_num_band);
11318|       |            if (!JPWL_ASSUME) {
11319|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
11320|       |                return OPJ_FALSE;
11321|       |            }
11322|       |            /* we try to correct */
11323|       |            l_num_band = 1;
11324|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust them\n"
11325|       |                          "- setting number of bands to %d => HYPOTHESIS!!!\n",
11326|       |                          l_num_band);
11327|       |        };
11328|       |
11329|       |    };
11330|       |#endif /* USE_JPWL */
11331|       |
11332|  10.9k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
  ------------------
  |  |   66|  10.9k|#define J2K_CCP_QNTSTY_NOQNT 0
  ------------------
  |  Branch (11332:9): [True: 8.99k, False: 1.97k]
  ------------------
11333|  80.8k|        for (l_band_no = 0; l_band_no < l_num_band; l_band_no++) {
  ------------------
  |  Branch (11333:29): [True: 71.8k, False: 8.99k]
  ------------------
11334|  71.8k|            opj_read_bytes(l_current_ptr, &l_tmp, 1);                       /* SPqcx_i */
  ------------------
  |  |   65|  71.8k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11335|  71.8k|            ++l_current_ptr;
11336|  71.8k|            if (l_band_no < OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  155|  71.8k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|  71.8k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11336:17): [True: 45.3k, False: 26.5k]
  ------------------
11337|  45.3k|                l_tccp->stepsizes[l_band_no].expn = (OPJ_INT32)(l_tmp >> 3);
11338|  45.3k|                l_tccp->stepsizes[l_band_no].mant = 0;
11339|  45.3k|            }
11340|  71.8k|        }
11341|       |
11342|  8.99k|        if (*p_header_size < l_num_band) {
  ------------------
  |  Branch (11342:13): [True: 0, False: 8.99k]
  ------------------
11343|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11344|      0|        }
11345|  8.99k|        *p_header_size = *p_header_size - l_num_band;
11346|  8.99k|    } else {
11347|  8.92k|        for (l_band_no = 0; l_band_no < l_num_band; l_band_no++) {
  ------------------
  |  Branch (11347:29): [True: 6.95k, False: 1.97k]
  ------------------
11348|  6.95k|            opj_read_bytes(l_current_ptr, &l_tmp, 2);                       /* SPqcx_i */
  ------------------
  |  |   65|  6.95k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11349|  6.95k|            l_current_ptr += 2;
11350|  6.95k|            if (l_band_no < OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  155|  6.95k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|  6.95k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11350:17): [True: 6.68k, False: 264]
  ------------------
11351|  6.68k|                l_tccp->stepsizes[l_band_no].expn = (OPJ_INT32)(l_tmp >> 11);
11352|  6.68k|                l_tccp->stepsizes[l_band_no].mant = l_tmp & 0x7ff;
11353|  6.68k|            }
11354|  6.95k|        }
11355|       |
11356|  1.97k|        if (*p_header_size < 2 * l_num_band) {
  ------------------
  |  Branch (11356:13): [True: 2, False: 1.97k]
  ------------------
11357|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
11358|      2|        }
11359|  1.97k|        *p_header_size = *p_header_size - 2 * l_num_band;
11360|  1.97k|    }
11361|       |
11362|       |    /* Add Antonin : if scalar_derived -> compute other stepsizes */
11363|  10.9k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
  ------------------
  |  |   67|  10.9k|#define J2K_CCP_QNTSTY_SIQNT 1
  ------------------
  |  Branch (11363:9): [True: 760, False: 10.2k]
  ------------------
11364|  73.7k|        for (l_band_no = 1; l_band_no < OPJ_J2K_MAXBANDS; l_band_no++) {
  ------------------
  |  |  155|  73.7k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|  73.7k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11364:29): [True: 72.9k, False: 760]
  ------------------
11365|  72.9k|            l_tccp->stepsizes[l_band_no].expn =
11366|  72.9k|                ((OPJ_INT32)(l_tccp->stepsizes[0].expn) - (OPJ_INT32)((l_band_no - 1) / 3) > 0)
  ------------------
  |  Branch (11366:17): [True: 23.7k, False: 49.2k]
  ------------------
11367|  72.9k|                ?
11368|  49.2k|                (OPJ_INT32)(l_tccp->stepsizes[0].expn) - (OPJ_INT32)((l_band_no - 1) / 3) : 0;
11369|  72.9k|            l_tccp->stepsizes[l_band_no].mant = l_tccp->stepsizes[0].mant;
11370|  72.9k|        }
11371|    760|    }
11372|       |
11373|  10.9k|    return OPJ_TRUE;
  ------------------
  |  |  117|  10.9k|#define OPJ_TRUE 1
  ------------------
11374|  10.9k|}
j2k.c:opj_j2k_copy_tile_quantization_parameters:
11377|  9.87k|{
11378|  9.87k|    OPJ_UINT32 i;
11379|  9.87k|    opj_cp_t *l_cp = NULL;
11380|  9.87k|    opj_tcp_t *l_tcp = NULL;
11381|  9.87k|    opj_tccp_t *l_ref_tccp = NULL;
11382|  9.87k|    opj_tccp_t *l_copied_tccp = NULL;
11383|  9.87k|    OPJ_UINT32 l_size;
11384|       |
11385|       |    /* preconditions */
11386|  9.87k|    assert(p_j2k != 00);
11387|       |
11388|  9.87k|    l_cp = &(p_j2k->m_cp);
11389|  9.87k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (11389:13): [True: 72, False: 9.80k]
  ------------------
11390|     72|            &l_cp->tcps[p_j2k->m_current_tile_number] :
11391|  9.87k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
11392|       |
11393|  9.87k|    l_ref_tccp = &l_tcp->tccps[0];
11394|  9.87k|    l_copied_tccp = l_ref_tccp + 1;
11395|  9.87k|    l_size = OPJ_J2K_MAXBANDS * sizeof(opj_stepsize_t);
  ------------------
  |  |  155|  9.87k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|  9.87k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11396|       |
11397|  85.9k|    for (i = 1; i < p_j2k->m_private_image->numcomps; ++i) {
  ------------------
  |  Branch (11397:17): [True: 76.0k, False: 9.87k]
  ------------------
11398|  76.0k|        l_copied_tccp->qntsty = l_ref_tccp->qntsty;
11399|  76.0k|        l_copied_tccp->numgbits = l_ref_tccp->numgbits;
11400|  76.0k|        memcpy(l_copied_tccp->stepsizes, l_ref_tccp->stepsizes, l_size);
11401|  76.0k|        ++l_copied_tccp;
11402|  76.0k|    }
11403|  9.87k|}
j2k.c:opj_j2k_read_qcc:
 3216|  1.08k|{
 3217|  1.08k|    OPJ_UINT32 l_num_comp, l_comp_no;
 3218|       |
 3219|       |    /* preconditions */
 3220|  1.08k|    assert(p_header_data != 00);
 3221|  1.08k|    assert(p_j2k != 00);
 3222|  1.08k|    assert(p_manager != 00);
 3223|       |
 3224|  1.08k|    l_num_comp = p_j2k->m_private_image->numcomps;
 3225|       |
 3226|  1.08k|    if (l_num_comp <= 256) {
  ------------------
  |  Branch (3226:9): [True: 271, False: 814]
  ------------------
 3227|    271|        if (p_header_size < 1) {
  ------------------
  |  Branch (3227:13): [True: 1, False: 270]
  ------------------
 3228|      1|            opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3229|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3230|      1|        }
 3231|    270|        opj_read_bytes(p_header_data, &l_comp_no, 1);
  ------------------
  |  |   65|    270|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3232|    270|        ++p_header_data;
 3233|    270|        --p_header_size;
 3234|    814|    } else {
 3235|    814|        if (p_header_size < 2) {
  ------------------
  |  Branch (3235:13): [True: 1, False: 813]
  ------------------
 3236|      1|            opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3237|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3238|      1|        }
 3239|    813|        opj_read_bytes(p_header_data, &l_comp_no, 2);
  ------------------
  |  |   65|    813|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3240|    813|        p_header_data += 2;
 3241|    813|        p_header_size -= 2;
 3242|    813|    }
 3243|       |
 3244|       |#ifdef USE_JPWL
 3245|       |    if (p_j2k->m_cp.correct) {
 3246|       |
 3247|       |        static OPJ_UINT32 backup_compno = 0;
 3248|       |
 3249|       |        /* compno is negative or larger than the number of components!!! */
 3250|       |        if (/*(l_comp_no < 0) ||*/ (l_comp_no >= l_num_comp)) {
 3251|       |            opj_event_msg(p_manager, EVT_ERROR,
 3252|       |                          "JPWL: bad component number in QCC (%d out of a maximum of %d)\n",
 3253|       |                          l_comp_no, l_num_comp);
 3254|       |            if (!JPWL_ASSUME) {
 3255|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 3256|       |                return OPJ_FALSE;
 3257|       |            }
 3258|       |            /* we try to correct */
 3259|       |            l_comp_no = backup_compno % l_num_comp;
 3260|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 3261|       |                          "- setting component number to %d\n",
 3262|       |                          l_comp_no);
 3263|       |        }
 3264|       |
 3265|       |        /* keep your private count of tiles */
 3266|       |        backup_compno++;
 3267|       |    };
 3268|       |#endif /* USE_JPWL */
 3269|       |
 3270|  1.08k|    if (l_comp_no >= p_j2k->m_private_image->numcomps) {
  ------------------
  |  Branch (3270:9): [True: 4, False: 1.07k]
  ------------------
 3271|      4|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3272|      4|                      "Invalid component number: %d, regarding the number of components %d\n",
 3273|      4|                      l_comp_no, p_j2k->m_private_image->numcomps);
 3274|      4|        return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 3275|      4|    }
 3276|       |
 3277|  1.07k|    if (! opj_j2k_read_SQcd_SQcc(p_j2k, l_comp_no, p_header_data, &p_header_size,
  ------------------
  |  Branch (3277:9): [True: 2, False: 1.07k]
  ------------------
 3278|  1.07k|                                 p_manager)) {
 3279|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3280|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3281|      2|    }
 3282|       |
 3283|  1.07k|    if (p_header_size != 0) {
  ------------------
  |  Branch (3283:9): [True: 2, False: 1.07k]
  ------------------
 3284|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3285|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3286|      2|    }
 3287|       |
 3288|  1.07k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.07k|#define OPJ_TRUE 1
  ------------------
 3289|  1.07k|}
j2k.c:opj_j2k_read_poc:
 3531|  1.11k|{
 3532|  1.11k|    OPJ_UINT32 i, l_nb_comp, l_tmp;
 3533|  1.11k|    opj_image_t * l_image = 00;
 3534|  1.11k|    OPJ_UINT32 l_old_poc_nb, l_current_poc_nb, l_current_poc_remaining;
 3535|  1.11k|    OPJ_UINT32 l_chunk_size, l_comp_room;
 3536|       |
 3537|  1.11k|    opj_cp_t *l_cp = 00;
 3538|  1.11k|    opj_tcp_t *l_tcp = 00;
 3539|  1.11k|    opj_poc_t *l_current_poc = 00;
 3540|       |
 3541|       |    /* preconditions */
 3542|  1.11k|    assert(p_header_data != 00);
 3543|  1.11k|    assert(p_j2k != 00);
 3544|  1.11k|    assert(p_manager != 00);
 3545|       |
 3546|  1.11k|    l_image = p_j2k->m_private_image;
 3547|  1.11k|    l_nb_comp = l_image->numcomps;
 3548|  1.11k|    if (l_nb_comp <= 256) {
  ------------------
  |  Branch (3548:9): [True: 1.04k, False: 65]
  ------------------
 3549|  1.04k|        l_comp_room = 1;
 3550|  1.04k|    } else {
 3551|     65|        l_comp_room = 2;
 3552|     65|    }
 3553|  1.11k|    l_chunk_size = 5 + 2 * l_comp_room;
 3554|  1.11k|    l_current_poc_nb = p_header_size / l_chunk_size;
 3555|  1.11k|    l_current_poc_remaining = p_header_size % l_chunk_size;
 3556|       |
 3557|  1.11k|    if ((l_current_poc_nb <= 0) || (l_current_poc_remaining != 0)) {
  ------------------
  |  Branch (3557:9): [True: 4, False: 1.10k]
  |  Branch (3557:36): [True: 1, False: 1.10k]
  ------------------
 3558|      5|        opj_event_msg(p_manager, EVT_ERROR, "Error reading POC marker\n");
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3559|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 3560|      5|    }
 3561|       |
 3562|  1.10k|    l_cp = &(p_j2k->m_cp);
 3563|  1.10k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (3563:13): [True: 50, False: 1.05k]
  ------------------
 3564|     50|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 3565|  1.10k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 3566|  1.10k|    l_old_poc_nb = l_tcp->POC ? l_tcp->numpocs + 1 : 0;
  ------------------
  |  Branch (3566:20): [True: 721, False: 385]
  ------------------
 3567|  1.10k|    l_current_poc_nb += l_old_poc_nb;
 3568|       |
 3569|  1.10k|    if (l_current_poc_nb >= J2K_MAX_POCS) {
  ------------------
  |  |  114|  1.10k|#define J2K_MAX_POCS    32      /**< Maximum number of POCs */
  ------------------
  |  Branch (3569:9): [True: 2, False: 1.10k]
  ------------------
 3570|      2|        opj_event_msg(p_manager, EVT_ERROR, "Too many POCs %d\n", l_current_poc_nb);
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3571|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3572|      2|    }
 3573|       |
 3574|       |    /* now poc is in use.*/
 3575|  1.10k|    l_tcp->POC = 1;
 3576|       |
 3577|  1.10k|    l_current_poc = &l_tcp->pocs[l_old_poc_nb];
 3578|  5.21k|    for (i = l_old_poc_nb; i < l_current_poc_nb; ++i) {
  ------------------
  |  Branch (3578:28): [True: 4.10k, False: 1.10k]
  ------------------
 3579|  4.10k|        opj_read_bytes(p_header_data, &(l_current_poc->resno0),
  ------------------
  |  |   65|  4.10k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3580|  4.10k|                       1);                               /* RSpoc_i */
 3581|  4.10k|        ++p_header_data;
 3582|  4.10k|        opj_read_bytes(p_header_data, &(l_current_poc->compno0),
  ------------------
  |  |   65|  4.10k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3583|  4.10k|                       l_comp_room);  /* CSpoc_i */
 3584|  4.10k|        p_header_data += l_comp_room;
 3585|  4.10k|        opj_read_bytes(p_header_data, &(l_current_poc->layno1),
  ------------------
  |  |   65|  4.10k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3586|  4.10k|                       2);                               /* LYEpoc_i */
 3587|       |        /* make sure layer end is in acceptable bounds */
 3588|  4.10k|        l_current_poc->layno1 = opj_uint_min(l_current_poc->layno1, l_tcp->numlayers);
 3589|  4.10k|        p_header_data += 2;
 3590|  4.10k|        opj_read_bytes(p_header_data, &(l_current_poc->resno1),
  ------------------
  |  |   65|  4.10k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3591|  4.10k|                       1);                               /* REpoc_i */
 3592|  4.10k|        ++p_header_data;
 3593|  4.10k|        opj_read_bytes(p_header_data, &(l_current_poc->compno1),
  ------------------
  |  |   65|  4.10k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3594|  4.10k|                       l_comp_room);  /* CEpoc_i */
 3595|  4.10k|        p_header_data += l_comp_room;
 3596|  4.10k|        opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  4.10k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3597|  4.10k|                       1);                                                                 /* Ppoc_i */
 3598|  4.10k|        ++p_header_data;
 3599|  4.10k|        l_current_poc->prg = (OPJ_PROG_ORDER) l_tmp;
 3600|       |        /* make sure comp is in acceptable bounds */
 3601|  4.10k|        l_current_poc->compno1 = opj_uint_min(l_current_poc->compno1, l_nb_comp);
 3602|  4.10k|        ++l_current_poc;
 3603|  4.10k|    }
 3604|       |
 3605|  1.10k|    l_tcp->numpocs = l_current_poc_nb - 1;
 3606|  1.10k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.10k|#define OPJ_TRUE 1
  ------------------
 3607|  1.10k|}
j2k.c:opj_j2k_read_siz:
 2079|  8.70k|{
 2080|  8.70k|    OPJ_UINT32 i;
 2081|  8.70k|    OPJ_UINT32 l_nb_comp;
 2082|  8.70k|    OPJ_UINT32 l_nb_comp_remain;
 2083|  8.70k|    OPJ_UINT32 l_remaining_size;
 2084|  8.70k|    OPJ_UINT32 l_nb_tiles;
 2085|  8.70k|    OPJ_UINT32 l_tmp, l_tx1, l_ty1;
 2086|  8.70k|    OPJ_UINT32 l_prec0, l_sgnd0;
 2087|  8.70k|    opj_image_t *l_image = 00;
 2088|  8.70k|    opj_cp_t *l_cp = 00;
 2089|  8.70k|    opj_image_comp_t * l_img_comp = 00;
 2090|  8.70k|    opj_tcp_t * l_current_tile_param = 00;
 2091|       |
 2092|       |    /* preconditions */
 2093|  8.70k|    assert(p_j2k != 00);
 2094|  8.70k|    assert(p_manager != 00);
 2095|  8.70k|    assert(p_header_data != 00);
 2096|       |
 2097|  8.70k|    l_image = p_j2k->m_private_image;
 2098|  8.70k|    l_cp = &(p_j2k->m_cp);
 2099|       |
 2100|       |    /* minimum size == 39 - 3 (= minimum component parameter) */
 2101|  8.70k|    if (p_header_size < 36) {
  ------------------
  |  Branch (2101:9): [True: 10, False: 8.69k]
  ------------------
 2102|     10|        opj_event_msg(p_manager, EVT_ERROR, "Error with SIZ marker size\n");
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2103|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 2104|     10|    }
 2105|       |
 2106|  8.69k|    l_remaining_size = p_header_size - 36;
 2107|  8.69k|    l_nb_comp = l_remaining_size / 3;
 2108|  8.69k|    l_nb_comp_remain = l_remaining_size % 3;
 2109|  8.69k|    if (l_nb_comp_remain != 0) {
  ------------------
  |  Branch (2109:9): [True: 1, False: 8.69k]
  ------------------
 2110|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error with SIZ marker size\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2111|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 2112|      1|    }
 2113|       |
 2114|  8.69k|    opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2115|  8.69k|                   2);                                                /* Rsiz (capabilities) */
 2116|  8.69k|    p_header_data += 2;
 2117|  8.69k|    l_cp->rsiz = (OPJ_UINT16) l_tmp;
 2118|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->x1, 4);   /* Xsiz */
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2119|  8.69k|    p_header_data += 4;
 2120|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->y1, 4);   /* Ysiz */
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2121|  8.69k|    p_header_data += 4;
 2122|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->x0, 4);   /* X0siz */
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2123|  8.69k|    p_header_data += 4;
 2124|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->y0, 4);   /* Y0siz */
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2125|  8.69k|    p_header_data += 4;
 2126|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tdx,
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2127|  8.69k|                   4);             /* XTsiz */
 2128|  8.69k|    p_header_data += 4;
 2129|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tdy,
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2130|  8.69k|                   4);             /* YTsiz */
 2131|  8.69k|    p_header_data += 4;
 2132|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tx0,
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2133|  8.69k|                   4);             /* XT0siz */
 2134|  8.69k|    p_header_data += 4;
 2135|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->ty0,
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2136|  8.69k|                   4);             /* YT0siz */
 2137|  8.69k|    p_header_data += 4;
 2138|  8.69k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_tmp,
  ------------------
  |  |   65|  8.69k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2139|  8.69k|                   2);                 /* Csiz */
 2140|  8.69k|    p_header_data += 2;
 2141|  8.69k|    if (l_tmp < 16385) {
  ------------------
  |  Branch (2141:9): [True: 8.68k, False: 6]
  ------------------
 2142|  8.68k|        l_image->numcomps = (OPJ_UINT16) l_tmp;
 2143|  8.68k|    } else {
 2144|      6|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2145|      6|                      "Error with SIZ marker: number of component is illegal -> %d\n", l_tmp);
 2146|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 2147|      6|    }
 2148|       |
 2149|  8.68k|    if (l_image->numcomps != l_nb_comp) {
  ------------------
  |  Branch (2149:9): [True: 29, False: 8.65k]
  ------------------
 2150|     29|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     29|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2151|     29|                      "Error with SIZ marker: number of component is not compatible with the remaining number of parameters ( %d vs %d)\n",
 2152|     29|                      l_image->numcomps, l_nb_comp);
 2153|     29|        return OPJ_FALSE;
  ------------------
  |  |  118|     29|#define OPJ_FALSE 0
  ------------------
 2154|     29|    }
 2155|       |
 2156|       |    /* testcase 4035.pdf.SIGSEGV.d8b.3375 */
 2157|       |    /* testcase issue427-null-image-size.jp2 */
 2158|  8.65k|    if ((l_image->x0 >= l_image->x1) || (l_image->y0 >= l_image->y1)) {
  ------------------
  |  Branch (2158:9): [True: 4, False: 8.65k]
  |  Branch (2158:41): [True: 5, False: 8.64k]
  ------------------
 2159|      9|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2160|      9|                      "Error with SIZ marker: negative or zero image size (%" PRId64 " x %" PRId64
 2161|      9|                      ")\n", (OPJ_INT64)l_image->x1 - l_image->x0,
 2162|      9|                      (OPJ_INT64)l_image->y1 - l_image->y0);
 2163|      9|        return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
 2164|      9|    }
 2165|       |    /* testcase 2539.pdf.SIGFPE.706.1712 (also 3622.pdf.SIGFPE.706.2916 and 4008.pdf.SIGFPE.706.3345 and maybe more) */
 2166|  8.64k|    if ((l_cp->tdx == 0U) || (l_cp->tdy == 0U)) {
  ------------------
  |  Branch (2166:9): [True: 3, False: 8.64k]
  |  Branch (2166:30): [True: 2, False: 8.64k]
  ------------------
 2167|      5|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2168|      5|                      "Error with SIZ marker: invalid tile size (tdx: %d, tdy: %d)\n", l_cp->tdx,
 2169|      5|                      l_cp->tdy);
 2170|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 2171|      5|    }
 2172|       |
 2173|       |    /* testcase issue427-illegal-tile-offset.jp2 */
 2174|  8.64k|    l_tx1 = opj_uint_adds(l_cp->tx0, l_cp->tdx); /* manage overflow */
 2175|  8.64k|    l_ty1 = opj_uint_adds(l_cp->ty0, l_cp->tdy); /* manage overflow */
 2176|  8.64k|    if ((l_cp->tx0 > l_image->x0) || (l_cp->ty0 > l_image->y0) ||
  ------------------
  |  Branch (2176:9): [True: 26, False: 8.61k]
  |  Branch (2176:38): [True: 19, False: 8.59k]
  ------------------
 2177|  8.64k|            (l_tx1 <= l_image->x0) || (l_ty1 <= l_image->y0)) {
  ------------------
  |  Branch (2177:13): [True: 13, False: 8.58k]
  |  Branch (2177:39): [True: 8, False: 8.57k]
  ------------------
 2178|     66|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     66|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2179|     66|                      "Error with SIZ marker: illegal tile offset\n");
 2180|     66|        return OPJ_FALSE;
  ------------------
  |  |  118|     66|#define OPJ_FALSE 0
  ------------------
 2181|     66|    }
 2182|  8.57k|    if (!p_j2k->dump_state) {
  ------------------
  |  Branch (2182:9): [True: 8.57k, False: 0]
  ------------------
 2183|  8.57k|        OPJ_UINT32 siz_w, siz_h;
 2184|       |
 2185|  8.57k|        siz_w = l_image->x1 - l_image->x0;
 2186|  8.57k|        siz_h = l_image->y1 - l_image->y0;
 2187|       |
 2188|  8.57k|        if (p_j2k->ihdr_w > 0 && p_j2k->ihdr_h > 0
  ------------------
  |  Branch (2188:13): [True: 0, False: 8.57k]
  |  Branch (2188:34): [True: 0, False: 0]
  ------------------
 2189|  8.57k|                && (p_j2k->ihdr_w != siz_w || p_j2k->ihdr_h != siz_h)) {
  ------------------
  |  Branch (2189:21): [True: 0, False: 0]
  |  Branch (2189:47): [True: 0, False: 0]
  ------------------
 2190|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2191|      0|                          "Error with SIZ marker: IHDR w(%u) h(%u) vs. SIZ w(%u) h(%u)\n", p_j2k->ihdr_w,
 2192|      0|                          p_j2k->ihdr_h, siz_w, siz_h);
 2193|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2194|      0|        }
 2195|  8.57k|    }
 2196|       |#ifdef USE_JPWL
 2197|       |    if (l_cp->correct) {
 2198|       |        /* if JPWL is on, we check whether TX errors have damaged
 2199|       |          too much the SIZ parameters */
 2200|       |        if (!(l_image->x1 * l_image->y1)) {
 2201|       |            opj_event_msg(p_manager, EVT_ERROR,
 2202|       |                          "JPWL: bad image size (%d x %d)\n",
 2203|       |                          l_image->x1, l_image->y1);
 2204|       |            if (!JPWL_ASSUME) {
 2205|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2206|       |                return OPJ_FALSE;
 2207|       |            }
 2208|       |        }
 2209|       |
 2210|       |        /* FIXME check previously in the function so why keep this piece of code ? Need by the norm ?
 2211|       |                if (l_image->numcomps != ((len - 38) / 3)) {
 2212|       |                        opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
 2213|       |                                "JPWL: Csiz is %d => space in SIZ only for %d comps.!!!\n",
 2214|       |                                l_image->numcomps, ((len - 38) / 3));
 2215|       |                        if (!JPWL_ASSUME) {
 2216|       |                                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2217|       |                                return OPJ_FALSE;
 2218|       |                        }
 2219|       |        */              /* we try to correct */
 2220|       |        /*              opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n");
 2221|       |                        if (l_image->numcomps < ((len - 38) / 3)) {
 2222|       |                                len = 38 + 3 * l_image->numcomps;
 2223|       |                                opj_event_msg(p_manager, EVT_WARNING, "- setting Lsiz to %d => HYPOTHESIS!!!\n",
 2224|       |                                        len);
 2225|       |                        } else {
 2226|       |                                l_image->numcomps = ((len - 38) / 3);
 2227|       |                                opj_event_msg(p_manager, EVT_WARNING, "- setting Csiz to %d => HYPOTHESIS!!!\n",
 2228|       |                                        l_image->numcomps);
 2229|       |                        }
 2230|       |                }
 2231|       |        */
 2232|       |
 2233|       |        /* update components number in the jpwl_exp_comps filed */
 2234|       |        l_cp->exp_comps = l_image->numcomps;
 2235|       |    }
 2236|       |#endif /* USE_JPWL */
 2237|       |
 2238|       |    /* Allocate the resulting image components */
 2239|  8.57k|    l_image->comps = (opj_image_comp_t*) opj_calloc(l_image->numcomps,
 2240|  8.57k|                     sizeof(opj_image_comp_t));
 2241|  8.57k|    if (l_image->comps == 00) {
  ------------------
  |  Branch (2241:9): [True: 32, False: 8.54k]
  ------------------
 2242|     32|        l_image->numcomps = 0;
 2243|     32|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     32|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2244|     32|                      "Not enough memory to take in charge SIZ marker\n");
 2245|     32|        return OPJ_FALSE;
  ------------------
  |  |  118|     32|#define OPJ_FALSE 0
  ------------------
 2246|     32|    }
 2247|       |
 2248|  8.54k|    l_img_comp = l_image->comps;
 2249|       |
 2250|  8.54k|    l_prec0 = 0;
 2251|  8.54k|    l_sgnd0 = 0;
 2252|       |    /* Read the component information */
 2253|  39.7k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2253:17): [True: 31.1k, False: 8.53k]
  ------------------
 2254|  31.1k|        OPJ_UINT32 tmp;
 2255|  31.1k|        opj_read_bytes(p_header_data, &tmp, 1); /* Ssiz_i */
  ------------------
  |  |   65|  31.1k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2256|  31.1k|        ++p_header_data;
 2257|  31.1k|        l_img_comp->prec = (tmp & 0x7f) + 1;
 2258|  31.1k|        l_img_comp->sgnd = tmp >> 7;
 2259|       |
 2260|  31.1k|        if (p_j2k->dump_state == 0) {
  ------------------
  |  Branch (2260:13): [True: 31.1k, False: 0]
  ------------------
 2261|  31.1k|            if (i == 0) {
  ------------------
  |  Branch (2261:17): [True: 8.54k, False: 22.6k]
  ------------------
 2262|  8.54k|                l_prec0 = l_img_comp->prec;
 2263|  8.54k|                l_sgnd0 = l_img_comp->sgnd;
 2264|  22.6k|            } else if (!l_cp->allow_different_bit_depth_sign
  ------------------
  |  Branch (2264:24): [True: 0, False: 22.6k]
  ------------------
 2265|  22.6k|                       && (l_img_comp->prec != l_prec0 || l_img_comp->sgnd != l_sgnd0)) {
  ------------------
  |  Branch (2265:28): [True: 0, False: 0]
  |  Branch (2265:59): [True: 0, False: 0]
  ------------------
 2266|      0|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2267|      0|                              "Despite JP2 BPC!=255, precision and/or sgnd values for comp[%d] is different than comp[0]:\n"
 2268|      0|                              "        [0] prec(%d) sgnd(%d) [%d] prec(%d) sgnd(%d)\n", i, l_prec0, l_sgnd0,
 2269|      0|                              i, l_img_comp->prec, l_img_comp->sgnd);
 2270|      0|            }
 2271|       |            /* TODO: we should perhaps also check against JP2 BPCC values */
 2272|  31.1k|        }
 2273|  31.1k|        opj_read_bytes(p_header_data, &tmp, 1); /* XRsiz_i */
  ------------------
  |  |   65|  31.1k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2274|  31.1k|        ++p_header_data;
 2275|  31.1k|        l_img_comp->dx = (OPJ_UINT32)tmp; /* should be between 1 and 255 */
 2276|  31.1k|        opj_read_bytes(p_header_data, &tmp, 1); /* YRsiz_i */
  ------------------
  |  |   65|  31.1k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2277|  31.1k|        ++p_header_data;
 2278|  31.1k|        l_img_comp->dy = (OPJ_UINT32)tmp; /* should be between 1 and 255 */
 2279|  31.1k|        if (l_img_comp->dx < 1 || l_img_comp->dx > 255 ||
  ------------------
  |  Branch (2279:13): [True: 2, False: 31.1k]
  |  Branch (2279:35): [True: 0, False: 31.1k]
  ------------------
 2280|  31.1k|                l_img_comp->dy < 1 || l_img_comp->dy > 255) {
  ------------------
  |  Branch (2280:17): [True: 4, False: 31.1k]
  |  Branch (2280:39): [True: 0, False: 31.1k]
  ------------------
 2281|      6|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2282|      6|                          "Invalid values for comp = %d : dx=%u dy=%u (should be between 1 and 255 according to the JPEG2000 norm)\n",
 2283|      6|                          i, l_img_comp->dx, l_img_comp->dy);
 2284|      6|            return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 2285|      6|        }
 2286|       |        /* Avoids later undefined shift in computation of */
 2287|       |        /* p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps[i].m_dc_level_shift = 1
 2288|       |                    << (l_image->comps[i].prec - 1); */
 2289|  31.1k|        if (l_img_comp->prec > 31) {
  ------------------
  |  Branch (2289:13): [True: 7, False: 31.1k]
  ------------------
 2290|      7|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      7|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2291|      7|                          "Invalid values for comp = %d : prec=%u (should be between 1 and 38 according to the JPEG2000 norm. OpenJpeg only supports up to 31)\n",
 2292|      7|                          i, l_img_comp->prec);
 2293|      7|            return OPJ_FALSE;
  ------------------
  |  |  118|      7|#define OPJ_FALSE 0
  ------------------
 2294|      7|        }
 2295|       |#ifdef USE_JPWL
 2296|       |        if (l_cp->correct) {
 2297|       |            /* if JPWL is on, we check whether TX errors have damaged
 2298|       |                    too much the SIZ parameters, again */
 2299|       |            if (!(l_image->comps[i].dx * l_image->comps[i].dy)) {
 2300|       |                opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
 2301|       |                              "JPWL: bad XRsiz_%d/YRsiz_%d (%d x %d)\n",
 2302|       |                              i, i, l_image->comps[i].dx, l_image->comps[i].dy);
 2303|       |                if (!JPWL_ASSUME) {
 2304|       |                    opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2305|       |                    return OPJ_FALSE;
 2306|       |                }
 2307|       |                /* we try to correct */
 2308|       |                opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust them\n");
 2309|       |                if (!l_image->comps[i].dx) {
 2310|       |                    l_image->comps[i].dx = 1;
 2311|       |                    opj_event_msg(p_manager, EVT_WARNING,
 2312|       |                                  "- setting XRsiz_%d to %d => HYPOTHESIS!!!\n",
 2313|       |                                  i, l_image->comps[i].dx);
 2314|       |                }
 2315|       |                if (!l_image->comps[i].dy) {
 2316|       |                    l_image->comps[i].dy = 1;
 2317|       |                    opj_event_msg(p_manager, EVT_WARNING,
 2318|       |                                  "- setting YRsiz_%d to %d => HYPOTHESIS!!!\n",
 2319|       |                                  i, l_image->comps[i].dy);
 2320|       |                }
 2321|       |            }
 2322|       |        }
 2323|       |#endif /* USE_JPWL */
 2324|  31.1k|        l_img_comp->resno_decoded =
 2325|  31.1k|            0;                                                          /* number of resolution decoded */
 2326|  31.1k|        l_img_comp->factor =
 2327|  31.1k|            l_cp->m_specific_param.m_dec.m_reduce; /* reducing factor per component */
 2328|  31.1k|        ++l_img_comp;
 2329|  31.1k|    }
 2330|       |
 2331|  8.53k|    if (l_cp->tdx == 0 || l_cp->tdy == 0) {
  ------------------
  |  Branch (2331:9): [True: 0, False: 8.53k]
  |  Branch (2331:27): [True: 0, False: 8.53k]
  ------------------
 2332|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2333|      0|    }
 2334|       |
 2335|       |    /* Compute the number of tiles */
 2336|  8.53k|    l_cp->tw = opj_uint_ceildiv(l_image->x1 - l_cp->tx0, l_cp->tdx);
 2337|  8.53k|    l_cp->th = opj_uint_ceildiv(l_image->y1 - l_cp->ty0, l_cp->tdy);
 2338|       |
 2339|       |    /* Check that the number of tiles is valid */
 2340|  8.53k|    if (l_cp->tw == 0 || l_cp->th == 0 || l_cp->tw > 65535 / l_cp->th) {
  ------------------
  |  Branch (2340:9): [True: 0, False: 8.53k]
  |  Branch (2340:26): [True: 0, False: 8.53k]
  |  Branch (2340:43): [True: 21, False: 8.51k]
  ------------------
 2341|     21|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     21|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2342|     21|                      "Invalid number of tiles : %u x %u (maximum fixed by jpeg2000 norm is 65535 tiles)\n",
 2343|     21|                      l_cp->tw, l_cp->th);
 2344|     21|        return OPJ_FALSE;
  ------------------
  |  |  118|     21|#define OPJ_FALSE 0
  ------------------
 2345|     21|    }
 2346|  8.51k|    l_nb_tiles = l_cp->tw * l_cp->th;
 2347|       |
 2348|       |    /* Define the tiles which will be decoded */
 2349|  8.51k|    if (p_j2k->m_specific_param.m_decoder.m_discard_tiles) {
  ------------------
  |  Branch (2349:9): [True: 0, False: 8.51k]
  ------------------
 2350|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x =
 2351|      0|            (p_j2k->m_specific_param.m_decoder.m_start_tile_x - l_cp->tx0) / l_cp->tdx;
 2352|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y =
 2353|      0|            (p_j2k->m_specific_param.m_decoder.m_start_tile_y - l_cp->ty0) / l_cp->tdy;
 2354|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = opj_uint_ceildiv(
 2355|      0|                    p_j2k->m_specific_param.m_decoder.m_end_tile_x - l_cp->tx0,
 2356|      0|                    l_cp->tdx);
 2357|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = opj_uint_ceildiv(
 2358|      0|                    p_j2k->m_specific_param.m_decoder.m_end_tile_y - l_cp->ty0,
 2359|      0|                    l_cp->tdy);
 2360|  8.51k|    } else {
 2361|  8.51k|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
 2362|  8.51k|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
 2363|  8.51k|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
 2364|  8.51k|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
 2365|  8.51k|    }
 2366|       |
 2367|       |#ifdef USE_JPWL
 2368|       |    if (l_cp->correct) {
 2369|       |        /* if JPWL is on, we check whether TX errors have damaged
 2370|       |          too much the SIZ parameters */
 2371|       |        if ((l_cp->tw < 1) || (l_cp->th < 1) || (l_cp->tw > l_cp->max_tiles) ||
 2372|       |                (l_cp->th > l_cp->max_tiles)) {
 2373|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
 2374|       |                          "JPWL: bad number of tiles (%d x %d)\n",
 2375|       |                          l_cp->tw, l_cp->th);
 2376|       |            if (!JPWL_ASSUME) {
 2377|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2378|       |                return OPJ_FALSE;
 2379|       |            }
 2380|       |            /* we try to correct */
 2381|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust them\n");
 2382|       |            if (l_cp->tw < 1) {
 2383|       |                l_cp->tw = 1;
 2384|       |                opj_event_msg(p_manager, EVT_WARNING,
 2385|       |                              "- setting %d tiles in x => HYPOTHESIS!!!\n",
 2386|       |                              l_cp->tw);
 2387|       |            }
 2388|       |            if (l_cp->tw > l_cp->max_tiles) {
 2389|       |                l_cp->tw = 1;
 2390|       |                opj_event_msg(p_manager, EVT_WARNING,
 2391|       |                              "- too large x, increase expectance of %d\n"
 2392|       |                              "- setting %d tiles in x => HYPOTHESIS!!!\n",
 2393|       |                              l_cp->max_tiles, l_cp->tw);
 2394|       |            }
 2395|       |            if (l_cp->th < 1) {
 2396|       |                l_cp->th = 1;
 2397|       |                opj_event_msg(p_manager, EVT_WARNING,
 2398|       |                              "- setting %d tiles in y => HYPOTHESIS!!!\n",
 2399|       |                              l_cp->th);
 2400|       |            }
 2401|       |            if (l_cp->th > l_cp->max_tiles) {
 2402|       |                l_cp->th = 1;
 2403|       |                opj_event_msg(p_manager, EVT_WARNING,
 2404|       |                              "- too large y, increase expectance of %d to continue\n",
 2405|       |                              "- setting %d tiles in y => HYPOTHESIS!!!\n",
 2406|       |                              l_cp->max_tiles, l_cp->th);
 2407|       |            }
 2408|       |        }
 2409|       |    }
 2410|       |#endif /* USE_JPWL */
 2411|       |
 2412|       |    /* memory allocations */
 2413|  8.51k|    l_cp->tcps = (opj_tcp_t*) opj_calloc(l_nb_tiles, sizeof(opj_tcp_t));
 2414|  8.51k|    if (l_cp->tcps == 00) {
  ------------------
  |  Branch (2414:9): [True: 0, False: 8.51k]
  ------------------
 2415|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2416|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2417|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2418|      0|    }
 2419|       |
 2420|       |#ifdef USE_JPWL
 2421|       |    if (l_cp->correct) {
 2422|       |        if (!l_cp->tcps) {
 2423|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
 2424|       |                          "JPWL: could not alloc tcps field of cp\n");
 2425|       |            if (!JPWL_ASSUME) {
 2426|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2427|       |                return OPJ_FALSE;
 2428|       |            }
 2429|       |        }
 2430|       |    }
 2431|       |#endif /* USE_JPWL */
 2432|       |
 2433|  8.51k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps =
 2434|  8.51k|        (opj_tccp_t*) opj_calloc(l_image->numcomps, sizeof(opj_tccp_t));
 2435|  8.51k|    if (p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps  == 00) {
  ------------------
  |  Branch (2435:9): [True: 0, False: 8.51k]
  ------------------
 2436|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2437|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2438|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2439|      0|    }
 2440|       |
 2441|  8.51k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records =
 2442|  8.51k|        (opj_mct_data_t*)opj_calloc(OPJ_J2K_MCT_DEFAULT_NB_RECORDS,
  ------------------
  |  |  161|  8.51k|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 2443|  8.51k|                                    sizeof(opj_mct_data_t));
 2444|       |
 2445|  8.51k|    if (! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records) {
  ------------------
  |  Branch (2445:9): [True: 0, False: 8.51k]
  ------------------
 2446|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2447|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2448|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2449|      0|    }
 2450|  8.51k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_nb_max_mct_records =
 2451|  8.51k|        OPJ_J2K_MCT_DEFAULT_NB_RECORDS;
  ------------------
  |  |  161|  8.51k|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 2452|       |
 2453|  8.51k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records =
 2454|  8.51k|        (opj_simple_mcc_decorrelation_data_t*)
 2455|  8.51k|        opj_calloc(OPJ_J2K_MCC_DEFAULT_NB_RECORDS,
  ------------------
  |  |  160|  8.51k|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 2456|  8.51k|                   sizeof(opj_simple_mcc_decorrelation_data_t));
 2457|       |
 2458|  8.51k|    if (! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records) {
  ------------------
  |  Branch (2458:9): [True: 0, False: 8.51k]
  ------------------
 2459|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2460|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2461|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2462|      0|    }
 2463|  8.51k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_nb_max_mcc_records =
 2464|  8.51k|        OPJ_J2K_MCC_DEFAULT_NB_RECORDS;
  ------------------
  |  |  160|  8.51k|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 2465|       |
 2466|       |    /* set up default dc level shift */
 2467|  39.3k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2467:17): [True: 30.8k, False: 8.51k]
  ------------------
 2468|  30.8k|        if (! l_image->comps[i].sgnd) {
  ------------------
  |  Branch (2468:13): [True: 24.0k, False: 6.76k]
  ------------------
 2469|  24.0k|            p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps[i].m_dc_level_shift = 1
 2470|  24.0k|                    << (l_image->comps[i].prec - 1);
 2471|  24.0k|        }
 2472|  30.8k|    }
 2473|       |
 2474|  8.51k|    l_current_tile_param = l_cp->tcps;
 2475|  19.1M|    for (i = 0; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (2475:17): [True: 19.1M, False: 8.51k]
  ------------------
 2476|  19.1M|        l_current_tile_param->tccps = (opj_tccp_t*) opj_calloc(l_image->numcomps,
 2477|  19.1M|                                      sizeof(opj_tccp_t));
 2478|  19.1M|        if (l_current_tile_param->tccps == 00) {
  ------------------
  |  Branch (2478:13): [True: 0, False: 19.1M]
  ------------------
 2479|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2480|      0|                          "Not enough memory to take in charge SIZ marker\n");
 2481|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2482|      0|        }
 2483|       |
 2484|  19.1M|        ++l_current_tile_param;
 2485|  19.1M|    }
 2486|       |
 2487|       |    /*Allocate and initialize some elements of codestrem index*/
 2488|  8.51k|    if (!opj_j2k_allocate_tile_element_cstr_index(p_j2k)) {
  ------------------
  |  Branch (2488:9): [True: 0, False: 8.51k]
  ------------------
 2489|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2490|      0|    }
 2491|       |
 2492|  8.51k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_MH;
 2493|  8.51k|    opj_image_comp_header_update(l_image, l_cp);
 2494|       |
 2495|  8.51k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.51k|#define OPJ_TRUE 1
  ------------------
 2496|  8.51k|}
j2k.c:opj_j2k_allocate_tile_element_cstr_index:
11855|  8.51k|{
11856|  8.51k|    OPJ_UINT32 it_tile = 0;
11857|       |
11858|  8.51k|    p_j2k->cstr_index->nb_of_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th;
11859|  8.51k|    p_j2k->cstr_index->tile_index = (opj_tile_index_t*)opj_calloc(
11860|  8.51k|                                        p_j2k->cstr_index->nb_of_tiles, sizeof(opj_tile_index_t));
11861|  8.51k|    if (!p_j2k->cstr_index->tile_index) {
  ------------------
  |  Branch (11861:9): [True: 0, False: 8.51k]
  ------------------
11862|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11863|      0|    }
11864|       |
11865|  19.1M|    for (it_tile = 0; it_tile < p_j2k->cstr_index->nb_of_tiles; it_tile++) {
  ------------------
  |  Branch (11865:23): [True: 19.1M, False: 8.51k]
  ------------------
11866|  19.1M|        p_j2k->cstr_index->tile_index[it_tile].maxmarknum = 100;
11867|  19.1M|        p_j2k->cstr_index->tile_index[it_tile].marknum = 0;
11868|  19.1M|        p_j2k->cstr_index->tile_index[it_tile].marker = (opj_marker_info_t*)
11869|  19.1M|                opj_calloc(p_j2k->cstr_index->tile_index[it_tile].maxmarknum,
11870|  19.1M|                           sizeof(opj_marker_info_t));
11871|  19.1M|        if (!p_j2k->cstr_index->tile_index[it_tile].marker) {
  ------------------
  |  Branch (11871:13): [True: 0, False: 19.1M]
  ------------------
11872|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11873|      0|        }
11874|  19.1M|    }
11875|       |
11876|  8.51k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.51k|#define OPJ_TRUE 1
  ------------------
11877|  8.51k|}
j2k.c:opj_j2k_read_tlm:
 3664|    240|{
 3665|    240|    OPJ_UINT32 l_Ztlm, l_Stlm, l_ST, l_SP,
 3666|    240|               l_Ptlm_size, l_entry_size, l_num_tileparts;
 3667|    240|    OPJ_UINT32 i;
 3668|    240|    opj_j2k_tlm_tile_part_info_t* l_tile_part_infos;
 3669|    240|    opj_j2k_tlm_info_t* l_tlm;
 3670|       |
 3671|       |    /* preconditions */
 3672|    240|    assert(p_header_data != 00);
 3673|    240|    assert(p_j2k != 00);
 3674|    240|    assert(p_manager != 00);
 3675|       |
 3676|    240|    l_tlm = &(p_j2k->m_specific_param.m_decoder.m_tlm);
 3677|       |
 3678|    240|    if (p_header_size < 2) {
  ------------------
  |  Branch (3678:9): [True: 2, False: 238]
  ------------------
 3679|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading TLM marker.\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3680|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3681|      2|    }
 3682|    238|    p_header_size -= 2;
 3683|       |
 3684|    238|    if (l_tlm->m_is_invalid) {
  ------------------
  |  Branch (3684:9): [True: 83, False: 155]
  ------------------
 3685|     83|        return OPJ_TRUE;
  ------------------
  |  |  117|     83|#define OPJ_TRUE 1
  ------------------
 3686|     83|    }
 3687|       |
 3688|    155|    opj_read_bytes(p_header_data, &l_Ztlm,
  ------------------
  |  |   65|    155|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3689|    155|                   1);                              /* Ztlm */
 3690|    155|    ++p_header_data;
 3691|    155|    opj_read_bytes(p_header_data, &l_Stlm,
  ------------------
  |  |   65|    155|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3692|    155|                   1);                              /* Stlm */
 3693|    155|    ++p_header_data;
 3694|       |
 3695|    155|    l_ST = ((l_Stlm >> 4) & 0x3);
 3696|    155|    if (l_ST == 3) {
  ------------------
  |  Branch (3696:9): [True: 2, False: 153]
  ------------------
 3697|      2|        l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 3698|      2|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      2|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 3699|      2|                      "opj_j2k_read_tlm(): ST = 3 is invalid.\n");
 3700|      2|        return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 3701|      2|    }
 3702|    153|    l_SP = (l_Stlm >> 6) & 0x1;
 3703|       |
 3704|    153|    l_Ptlm_size = (l_SP + 1) * 2;
 3705|    153|    l_entry_size = l_Ptlm_size + l_ST;
 3706|       |
 3707|    153|    if ((p_header_size % l_entry_size) != 0) {
  ------------------
  |  Branch (3707:9): [True: 1, False: 152]
  ------------------
 3708|      1|        l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
 3709|      1|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      1|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 3710|      1|                      "opj_j2k_read_tlm(): TLM marker not of expected size.\n");
 3711|      1|        return OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
 3712|      1|    }
 3713|       |
 3714|    152|    l_num_tileparts = p_header_size / l_entry_size;
 3715|    152|    if (l_num_tileparts == 0) {
  ------------------
  |  Branch (3715:9): [True: 137, False: 15]
  ------------------
 3716|       |        /* not totally sure if this is valid... */
 3717|    137|        return OPJ_TRUE;
  ------------------
  |  |  117|    137|#define OPJ_TRUE 1
  ------------------
 3718|    137|    }
 3719|       |
 3720|       |    /* Highly unlikely, unless there are gazillions of TLM markers */
 3721|     15|    if (l_tlm->m_entries_count > UINT32_MAX - l_num_tileparts ||
  ------------------
  |  Branch (3721:9): [True: 0, False: 15]
  ------------------
 3722|     15|            l_tlm->m_entries_count + l_num_tileparts > UINT32_MAX / sizeof(
  ------------------
  |  Branch (3722:13): [True: 0, False: 15]
  ------------------
 3723|     15|                opj_j2k_tlm_tile_part_info_t)) {
 3724|      0|        l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3725|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 3726|      0|                      "opj_j2k_read_tlm(): too many TLM markers.\n");
 3727|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3728|      0|    }
 3729|       |
 3730|     15|    l_tile_part_infos = (opj_j2k_tlm_tile_part_info_t*)opj_realloc(
 3731|     15|                            l_tlm->m_tile_part_infos,
 3732|     15|                            (l_tlm->m_entries_count + l_num_tileparts) * sizeof(
 3733|     15|                                opj_j2k_tlm_tile_part_info_t));
 3734|     15|    if (!l_tile_part_infos) {
  ------------------
  |  Branch (3734:9): [True: 0, False: 15]
  ------------------
 3735|      0|        l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3736|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 3737|      0|                      "opj_j2k_read_tlm(): cannot allocate m_tile_part_infos.\n");
 3738|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3739|      0|    }
 3740|       |
 3741|     15|    l_tlm->m_tile_part_infos = l_tile_part_infos;
 3742|       |
 3743|    174|    for (i = 0; i < l_num_tileparts; ++ i) {
  ------------------
  |  Branch (3743:17): [True: 170, False: 4]
  ------------------
 3744|    170|        OPJ_UINT32 l_tile_index;
 3745|    170|        OPJ_UINT32 l_length;
 3746|       |
 3747|       |        /* Read Ttlm_i */
 3748|    170|        if (l_ST == 0) {
  ------------------
  |  Branch (3748:13): [True: 138, False: 32]
  ------------------
 3749|    138|            l_tile_index = l_tlm->m_entries_count;
 3750|    138|        } else {
 3751|     32|            opj_read_bytes(p_header_data, &l_tile_index, l_ST);
  ------------------
  |  |   65|     32|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3752|     32|            p_header_data += l_ST;
 3753|     32|        }
 3754|       |
 3755|    170|        if (l_tile_index >= p_j2k->m_cp.tw * p_j2k->m_cp.th) {
  ------------------
  |  Branch (3755:13): [True: 11, False: 159]
  ------------------
 3756|     11|            l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|     11|#define OPJ_TRUE 1
  ------------------
 3757|     11|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     11|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 3758|     11|                          "opj_j2k_read_tlm(): invalid tile number %d\n",
 3759|     11|                          l_tile_index);
 3760|     11|            return OPJ_TRUE;
  ------------------
  |  |  117|     11|#define OPJ_TRUE 1
  ------------------
 3761|     11|        }
 3762|       |
 3763|       |        /* Read Ptlm_i */
 3764|    159|        opj_read_bytes(p_header_data, &l_length, l_Ptlm_size);
  ------------------
  |  |   65|    159|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3765|    159|        p_header_data += l_Ptlm_size;
 3766|       |
 3767|    159|        l_tile_part_infos[l_tlm->m_entries_count].m_tile_index =
 3768|    159|            (OPJ_UINT16)l_tile_index;
 3769|    159|        l_tile_part_infos[l_tlm->m_entries_count].m_length = l_length;
 3770|    159|        ++l_tlm->m_entries_count;
 3771|    159|    }
 3772|       |
 3773|      4|    return OPJ_TRUE;
  ------------------
  |  |  117|      4|#define OPJ_TRUE 1
  ------------------
 3774|     15|}
j2k.c:opj_j2k_read_plm:
 3789|    130|{
 3790|       |    /* preconditions */
 3791|    130|    assert(p_header_data != 00);
 3792|    130|    assert(p_j2k != 00);
 3793|    130|    assert(p_manager != 00);
 3794|       |
 3795|    130|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  221|    130|#define OPJ_UNUSED(x) (void)x
  ------------------
 3796|    130|    OPJ_UNUSED(p_header_data);
  ------------------
  |  |  221|    130|#define OPJ_UNUSED(x) (void)x
  ------------------
 3797|       |
 3798|    130|    if (p_header_size < 1) {
  ------------------
  |  Branch (3798:9): [True: 1, False: 129]
  ------------------
 3799|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3800|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3801|      1|    }
 3802|       |    /* Do not care of this at the moment since only local variables are set here */
 3803|       |    /*
 3804|       |    opj_read_bytes(p_header_data,&l_Zplm,1);                                        // Zplm
 3805|       |    ++p_header_data;
 3806|       |    --p_header_size;
 3807|       |
 3808|       |    while
 3809|       |            (p_header_size > 0)
 3810|       |    {
 3811|       |            opj_read_bytes(p_header_data,&l_Nplm,1);                                // Nplm
 3812|       |            ++p_header_data;
 3813|       |            p_header_size -= (1+l_Nplm);
 3814|       |            if
 3815|       |                    (p_header_size < 0)
 3816|       |            {
 3817|       |                    opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
 3818|       |                    return false;
 3819|       |            }
 3820|       |            for
 3821|       |                    (i = 0; i < l_Nplm; ++i)
 3822|       |            {
 3823|       |                    opj_read_bytes(p_header_data,&l_tmp,1);                         // Iplm_ij
 3824|       |                    ++p_header_data;
 3825|       |                    // take only the last seven bytes
 3826|       |                    l_packet_len |= (l_tmp & 0x7f);
 3827|       |                    if
 3828|       |                            (l_tmp & 0x80)
 3829|       |                    {
 3830|       |                            l_packet_len <<= 7;
 3831|       |                    }
 3832|       |                    else
 3833|       |                    {
 3834|       |            // store packet length and proceed to next packet
 3835|       |                            l_packet_len = 0;
 3836|       |                    }
 3837|       |            }
 3838|       |            if
 3839|       |                    (l_packet_len != 0)
 3840|       |            {
 3841|       |                    opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
 3842|       |                    return false;
 3843|       |            }
 3844|       |    }
 3845|       |    */
 3846|    129|    return OPJ_TRUE;
  ------------------
  |  |  117|    129|#define OPJ_TRUE 1
  ------------------
 3847|    130|}
j2k.c:opj_j2k_read_plt:
 3862|    157|{
 3863|    157|    OPJ_UINT32 l_Zplt, l_tmp, l_packet_len = 0, i;
 3864|       |
 3865|       |    /* preconditions */
 3866|    157|    assert(p_header_data != 00);
 3867|    157|    assert(p_j2k != 00);
 3868|    157|    assert(p_manager != 00);
 3869|       |
 3870|    157|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  221|    157|#define OPJ_UNUSED(x) (void)x
  ------------------
 3871|       |
 3872|    157|    if (p_header_size < 1) {
  ------------------
  |  Branch (3872:9): [True: 1, False: 156]
  ------------------
 3873|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PLT marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3874|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3875|      1|    }
 3876|       |
 3877|    156|    opj_read_bytes(p_header_data, &l_Zplt, 1);              /* Zplt */
  ------------------
  |  |   65|    156|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3878|    156|    ++p_header_data;
 3879|    156|    --p_header_size;
 3880|       |
 3881|  17.1k|    for (i = 0; i < p_header_size; ++i) {
  ------------------
  |  Branch (3881:17): [True: 16.9k, False: 156]
  ------------------
 3882|  16.9k|        opj_read_bytes(p_header_data, &l_tmp, 1);       /* Iplt_ij */
  ------------------
  |  |   65|  16.9k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3883|  16.9k|        ++p_header_data;
 3884|       |        /* take only the last seven bytes */
 3885|  16.9k|        l_packet_len |= (l_tmp & 0x7f);
 3886|  16.9k|        if (l_tmp & 0x80) {
  ------------------
  |  Branch (3886:13): [True: 4.75k, False: 12.2k]
  ------------------
 3887|  4.75k|            l_packet_len <<= 7;
 3888|  12.2k|        } else {
 3889|       |            /* store packet length and proceed to next packet */
 3890|  12.2k|            l_packet_len = 0;
 3891|  12.2k|        }
 3892|  16.9k|    }
 3893|       |
 3894|    156|    if (l_packet_len != 0) {
  ------------------
  |  Branch (3894:9): [True: 5, False: 151]
  ------------------
 3895|      5|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PLT marker\n");
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3896|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 3897|      5|    }
 3898|       |
 3899|    151|    return OPJ_TRUE;
  ------------------
  |  |  117|    151|#define OPJ_TRUE 1
  ------------------
 3900|    156|}
j2k.c:opj_j2k_read_ppm:
 3916|    533|{
 3917|    533|    opj_cp_t *l_cp = 00;
 3918|    533|    OPJ_UINT32 l_Z_ppm;
 3919|       |
 3920|       |    /* preconditions */
 3921|    533|    assert(p_header_data != 00);
 3922|    533|    assert(p_j2k != 00);
 3923|    533|    assert(p_manager != 00);
 3924|       |
 3925|       |    /* We need to have the Z_ppm element + 1 byte of Nppm/Ippm at minimum */
 3926|    533|    if (p_header_size < 2) {
  ------------------
  |  Branch (3926:9): [True: 2, False: 531]
  ------------------
 3927|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PPM marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3928|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3929|      2|    }
 3930|       |
 3931|    531|    l_cp = &(p_j2k->m_cp);
 3932|    531|    l_cp->ppm = 1;
 3933|       |
 3934|    531|    opj_read_bytes(p_header_data, &l_Z_ppm, 1);             /* Z_ppm */
  ------------------
  |  |   65|    531|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3935|    531|    ++p_header_data;
 3936|    531|    --p_header_size;
 3937|       |
 3938|       |    /* check allocation needed */
 3939|    531|    if (l_cp->ppm_markers == NULL) { /* first PPM marker */
  ------------------
  |  Branch (3939:9): [True: 116, False: 415]
  ------------------
 3940|    116|        OPJ_UINT32 l_newCount = l_Z_ppm + 1U; /* can't overflow, l_Z_ppm is UINT8 */
 3941|    116|        assert(l_cp->ppm_markers_count == 0U);
 3942|       |
 3943|    116|        l_cp->ppm_markers = (opj_ppx *) opj_calloc(l_newCount, sizeof(opj_ppx));
 3944|    116|        if (l_cp->ppm_markers == NULL) {
  ------------------
  |  Branch (3944:13): [True: 0, False: 116]
  ------------------
 3945|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPM marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3946|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3947|      0|        }
 3948|    116|        l_cp->ppm_markers_count = l_newCount;
 3949|    415|    } else if (l_cp->ppm_markers_count <= l_Z_ppm) {
  ------------------
  |  Branch (3949:16): [True: 216, False: 199]
  ------------------
 3950|    216|        OPJ_UINT32 l_newCount = l_Z_ppm + 1U; /* can't overflow, l_Z_ppm is UINT8 */
 3951|    216|        opj_ppx *new_ppm_markers;
 3952|    216|        new_ppm_markers = (opj_ppx *) opj_realloc(l_cp->ppm_markers,
 3953|    216|                          l_newCount * sizeof(opj_ppx));
 3954|    216|        if (new_ppm_markers == NULL) {
  ------------------
  |  Branch (3954:13): [True: 0, False: 216]
  ------------------
 3955|       |            /* clean up to be done on l_cp destruction */
 3956|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPM marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3957|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3958|      0|        }
 3959|    216|        l_cp->ppm_markers = new_ppm_markers;
 3960|    216|        memset(l_cp->ppm_markers + l_cp->ppm_markers_count, 0,
 3961|    216|               (l_newCount - l_cp->ppm_markers_count) * sizeof(opj_ppx));
 3962|    216|        l_cp->ppm_markers_count = l_newCount;
 3963|    216|    }
 3964|       |
 3965|    531|    if (l_cp->ppm_markers[l_Z_ppm].m_data != NULL) {
  ------------------
  |  Branch (3965:9): [True: 2, False: 529]
  ------------------
 3966|       |        /* clean up to be done on l_cp destruction */
 3967|      2|        opj_event_msg(p_manager, EVT_ERROR, "Zppm %u already read\n", l_Z_ppm);
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3968|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3969|      2|    }
 3970|       |
 3971|    529|    l_cp->ppm_markers[l_Z_ppm].m_data = (OPJ_BYTE *) opj_malloc(p_header_size);
 3972|    529|    if (l_cp->ppm_markers[l_Z_ppm].m_data == NULL) {
  ------------------
  |  Branch (3972:9): [True: 0, False: 529]
  ------------------
 3973|       |        /* clean up to be done on l_cp destruction */
 3974|      0|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPM marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3975|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3976|      0|    }
 3977|    529|    l_cp->ppm_markers[l_Z_ppm].m_data_size = p_header_size;
 3978|    529|    memcpy(l_cp->ppm_markers[l_Z_ppm].m_data, p_header_data, p_header_size);
 3979|       |
 3980|    529|    return OPJ_TRUE;
  ------------------
  |  |  117|    529|#define OPJ_TRUE 1
  ------------------
 3981|    529|}
j2k.c:opj_j2k_read_ppt:
 4137|     89|{
 4138|     89|    opj_cp_t *l_cp = 00;
 4139|     89|    opj_tcp_t *l_tcp = 00;
 4140|     89|    OPJ_UINT32 l_Z_ppt;
 4141|       |
 4142|       |    /* preconditions */
 4143|     89|    assert(p_header_data != 00);
 4144|     89|    assert(p_j2k != 00);
 4145|     89|    assert(p_manager != 00);
 4146|       |
 4147|       |    /* We need to have the Z_ppt element + 1 byte of Ippt at minimum */
 4148|     89|    if (p_header_size < 2) {
  ------------------
  |  Branch (4148:9): [True: 1, False: 88]
  ------------------
 4149|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PPT marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4150|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4151|      1|    }
 4152|       |
 4153|     88|    l_cp = &(p_j2k->m_cp);
 4154|     88|    if (l_cp->ppm) {
  ------------------
  |  Branch (4154:9): [True: 1, False: 87]
  ------------------
 4155|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4156|      1|                      "Error reading PPT marker: packet header have been previously found in the main header (PPM marker).\n");
 4157|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4158|      1|    }
 4159|       |
 4160|     87|    l_tcp = &(l_cp->tcps[p_j2k->m_current_tile_number]);
 4161|     87|    l_tcp->ppt = 1;
 4162|       |
 4163|     87|    opj_read_bytes(p_header_data, &l_Z_ppt, 1);             /* Z_ppt */
  ------------------
  |  |   65|     87|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4164|     87|    ++p_header_data;
 4165|     87|    --p_header_size;
 4166|       |
 4167|       |    /* check allocation needed */
 4168|     87|    if (l_tcp->ppt_markers == NULL) { /* first PPT marker */
  ------------------
  |  Branch (4168:9): [True: 63, False: 24]
  ------------------
 4169|     63|        OPJ_UINT32 l_newCount = l_Z_ppt + 1U; /* can't overflow, l_Z_ppt is UINT8 */
 4170|     63|        assert(l_tcp->ppt_markers_count == 0U);
 4171|       |
 4172|     63|        l_tcp->ppt_markers = (opj_ppx *) opj_calloc(l_newCount, sizeof(opj_ppx));
 4173|     63|        if (l_tcp->ppt_markers == NULL) {
  ------------------
  |  Branch (4173:13): [True: 0, False: 63]
  ------------------
 4174|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4175|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4176|      0|        }
 4177|     63|        l_tcp->ppt_markers_count = l_newCount;
 4178|     63|    } else if (l_tcp->ppt_markers_count <= l_Z_ppt) {
  ------------------
  |  Branch (4178:16): [True: 13, False: 11]
  ------------------
 4179|     13|        OPJ_UINT32 l_newCount = l_Z_ppt + 1U; /* can't overflow, l_Z_ppt is UINT8 */
 4180|     13|        opj_ppx *new_ppt_markers;
 4181|     13|        new_ppt_markers = (opj_ppx *) opj_realloc(l_tcp->ppt_markers,
 4182|     13|                          l_newCount * sizeof(opj_ppx));
 4183|     13|        if (new_ppt_markers == NULL) {
  ------------------
  |  Branch (4183:13): [True: 0, False: 13]
  ------------------
 4184|       |            /* clean up to be done on l_tcp destruction */
 4185|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4186|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4187|      0|        }
 4188|     13|        l_tcp->ppt_markers = new_ppt_markers;
 4189|     13|        memset(l_tcp->ppt_markers + l_tcp->ppt_markers_count, 0,
 4190|     13|               (l_newCount - l_tcp->ppt_markers_count) * sizeof(opj_ppx));
 4191|     13|        l_tcp->ppt_markers_count = l_newCount;
 4192|     13|    }
 4193|       |
 4194|     87|    if (l_tcp->ppt_markers[l_Z_ppt].m_data != NULL) {
  ------------------
  |  Branch (4194:9): [True: 1, False: 86]
  ------------------
 4195|       |        /* clean up to be done on l_tcp destruction */
 4196|      1|        opj_event_msg(p_manager, EVT_ERROR, "Zppt %u already read\n", l_Z_ppt);
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4197|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4198|      1|    }
 4199|       |
 4200|     86|    l_tcp->ppt_markers[l_Z_ppt].m_data = (OPJ_BYTE *) opj_malloc(p_header_size);
 4201|     86|    if (l_tcp->ppt_markers[l_Z_ppt].m_data == NULL) {
  ------------------
  |  Branch (4201:9): [True: 0, False: 86]
  ------------------
 4202|       |        /* clean up to be done on l_tcp destruction */
 4203|      0|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4204|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4205|      0|    }
 4206|     86|    l_tcp->ppt_markers[l_Z_ppt].m_data_size = p_header_size;
 4207|     86|    memcpy(l_tcp->ppt_markers[l_Z_ppt].m_data, p_header_data, p_header_size);
 4208|     86|    return OPJ_TRUE;
  ------------------
  |  |  117|     86|#define OPJ_TRUE 1
  ------------------
 4209|     86|}
j2k.c:opj_j2k_read_crg:
 3622|     71|{
 3623|     71|    OPJ_UINT32 l_nb_comp;
 3624|       |    /* preconditions */
 3625|     71|    assert(p_header_data != 00);
 3626|     71|    assert(p_j2k != 00);
 3627|     71|    assert(p_manager != 00);
 3628|       |
 3629|     71|    OPJ_UNUSED(p_header_data);
  ------------------
  |  |  221|     71|#define OPJ_UNUSED(x) (void)x
  ------------------
 3630|       |
 3631|     71|    l_nb_comp = p_j2k->m_private_image->numcomps;
 3632|       |
 3633|     71|    if (p_header_size != l_nb_comp * 4) {
  ------------------
  |  Branch (3633:9): [True: 2, False: 69]
  ------------------
 3634|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading CRG marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3635|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3636|      2|    }
 3637|       |    /* Do not care of this at the moment since only local variables are set here */
 3638|       |    /*
 3639|       |    for
 3640|       |            (i = 0; i < l_nb_comp; ++i)
 3641|       |    {
 3642|       |            opj_read_bytes(p_header_data,&l_Xcrg_i,2);                              // Xcrg_i
 3643|       |            p_header_data+=2;
 3644|       |            opj_read_bytes(p_header_data,&l_Ycrg_i,2);                              // Xcrg_i
 3645|       |            p_header_data+=2;
 3646|       |    }
 3647|       |    */
 3648|     69|    return OPJ_TRUE;
  ------------------
  |  |  117|     69|#define OPJ_TRUE 1
  ------------------
 3649|     71|}
j2k.c:opj_j2k_read_com:
 2568|  3.66k|{
 2569|       |    /* preconditions */
 2570|  3.66k|    assert(p_j2k != 00);
 2571|  3.66k|    assert(p_manager != 00);
 2572|  3.66k|    assert(p_header_data != 00);
 2573|       |
 2574|  3.66k|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  221|  3.66k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2575|  3.66k|    OPJ_UNUSED(p_header_data);
  ------------------
  |  |  221|  3.66k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2576|  3.66k|    OPJ_UNUSED(p_header_size);
  ------------------
  |  |  221|  3.66k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2577|  3.66k|    OPJ_UNUSED(p_manager);
  ------------------
  |  |  221|  3.66k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2578|       |
 2579|  3.66k|    return OPJ_TRUE;
  ------------------
  |  |  117|  3.66k|#define OPJ_TRUE 1
  ------------------
 2580|  3.66k|}
j2k.c:opj_j2k_read_mct:
 5869|  4.81k|{
 5870|  4.81k|    OPJ_UINT32 i;
 5871|  4.81k|    opj_tcp_t *l_tcp = 00;
 5872|  4.81k|    OPJ_UINT32 l_tmp;
 5873|  4.81k|    OPJ_UINT32 l_indix;
 5874|  4.81k|    opj_mct_data_t * l_mct_data;
 5875|       |
 5876|       |    /* preconditions */
 5877|  4.81k|    assert(p_header_data != 00);
 5878|  4.81k|    assert(p_j2k != 00);
 5879|       |
 5880|  4.81k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (5880:13): [True: 7, False: 4.81k]
  ------------------
 5881|      7|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 5882|  4.81k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 5883|       |
 5884|  4.81k|    if (p_header_size < 2) {
  ------------------
  |  Branch (5884:9): [True: 2, False: 4.81k]
  ------------------
 5885|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5886|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 5887|      2|    }
 5888|       |
 5889|       |    /* first marker */
 5890|  4.81k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Zmct */
  ------------------
  |  |   65|  4.81k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5891|  4.81k|    p_header_data += 2;
 5892|  4.81k|    if (l_tmp != 0) {
  ------------------
  |  Branch (5892:9): [True: 551, False: 4.26k]
  ------------------
 5893|    551|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    551|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5894|    551|                      "Cannot take in charge mct data within multiple MCT records\n");
 5895|    551|        return OPJ_TRUE;
  ------------------
  |  |  117|    551|#define OPJ_TRUE 1
  ------------------
 5896|    551|    }
 5897|       |
 5898|  4.26k|    if (p_header_size <= 6) {
  ------------------
  |  Branch (5898:9): [True: 1, False: 4.26k]
  ------------------
 5899|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5900|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 5901|      1|    }
 5902|       |
 5903|       |    /* Imct -> no need for other values, take the first, type is double with decorrelation x0000 1101 0000 0000*/
 5904|  4.26k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Imct */
  ------------------
  |  |   65|  4.26k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5905|  4.26k|    p_header_data += 2;
 5906|       |
 5907|  4.26k|    l_indix = l_tmp & 0xff;
 5908|  4.26k|    l_mct_data = l_tcp->m_mct_records;
 5909|       |
 5910|  18.9k|    for (i = 0; i < l_tcp->m_nb_mct_records; ++i) {
  ------------------
  |  Branch (5910:17): [True: 18.1k, False: 773]
  ------------------
 5911|  18.1k|        if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (5911:13): [True: 3.49k, False: 14.6k]
  ------------------
 5912|  3.49k|            break;
 5913|  3.49k|        }
 5914|  14.6k|        ++l_mct_data;
 5915|  14.6k|    }
 5916|       |
 5917|       |    /* NOT FOUND */
 5918|  4.26k|    if (i == l_tcp->m_nb_mct_records) {
  ------------------
  |  Branch (5918:9): [True: 773, False: 3.49k]
  ------------------
 5919|    773|        if (l_tcp->m_nb_mct_records == l_tcp->m_nb_max_mct_records) {
  ------------------
  |  Branch (5919:13): [True: 36, False: 737]
  ------------------
 5920|     36|            opj_mct_data_t *new_mct_records;
 5921|     36|            l_tcp->m_nb_max_mct_records += OPJ_J2K_MCT_DEFAULT_NB_RECORDS;
  ------------------
  |  |  161|     36|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 5922|       |
 5923|     36|            new_mct_records = (opj_mct_data_t *) opj_realloc(l_tcp->m_mct_records,
 5924|     36|                              l_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t));
 5925|     36|            if (! new_mct_records) {
  ------------------
  |  Branch (5925:17): [True: 0, False: 36]
  ------------------
 5926|      0|                opj_free(l_tcp->m_mct_records);
 5927|      0|                l_tcp->m_mct_records = NULL;
 5928|      0|                l_tcp->m_nb_max_mct_records = 0;
 5929|      0|                l_tcp->m_nb_mct_records = 0;
 5930|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read MCT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5931|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5932|      0|            }
 5933|       |
 5934|       |            /* Update m_mcc_records[].m_offset_array and m_decorrelation_array
 5935|       |             * to point to the new addresses */
 5936|     36|            if (new_mct_records != l_tcp->m_mct_records) {
  ------------------
  |  Branch (5936:17): [True: 32, False: 4]
  ------------------
 5937|    158|                for (i = 0; i < l_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (5937:29): [True: 126, False: 32]
  ------------------
 5938|    126|                    opj_simple_mcc_decorrelation_data_t* l_mcc_record =
 5939|    126|                        &(l_tcp->m_mcc_records[i]);
 5940|    126|                    if (l_mcc_record->m_decorrelation_array) {
  ------------------
  |  Branch (5940:25): [True: 31, False: 95]
  ------------------
 5941|     31|                        l_mcc_record->m_decorrelation_array =
 5942|     31|                            new_mct_records +
 5943|     31|                            (l_mcc_record->m_decorrelation_array -
 5944|     31|                             l_tcp->m_mct_records);
 5945|     31|                    }
 5946|    126|                    if (l_mcc_record->m_offset_array) {
  ------------------
  |  Branch (5946:25): [True: 31, False: 95]
  ------------------
 5947|     31|                        l_mcc_record->m_offset_array =
 5948|     31|                            new_mct_records +
 5949|     31|                            (l_mcc_record->m_offset_array -
 5950|     31|                             l_tcp->m_mct_records);
 5951|     31|                    }
 5952|    126|                }
 5953|     32|            }
 5954|       |
 5955|     36|            l_tcp->m_mct_records = new_mct_records;
 5956|     36|            l_mct_data = l_tcp->m_mct_records + l_tcp->m_nb_mct_records;
 5957|     36|            memset(l_mct_data, 0, (l_tcp->m_nb_max_mct_records - l_tcp->m_nb_mct_records) *
 5958|     36|                   sizeof(opj_mct_data_t));
 5959|     36|        }
 5960|       |
 5961|    773|        l_mct_data = l_tcp->m_mct_records + l_tcp->m_nb_mct_records;
 5962|    773|        ++l_tcp->m_nb_mct_records;
 5963|    773|    }
 5964|       |
 5965|  4.26k|    if (l_mct_data->m_data) {
  ------------------
  |  Branch (5965:9): [True: 672, False: 3.59k]
  ------------------
 5966|    672|        opj_free(l_mct_data->m_data);
 5967|    672|        l_mct_data->m_data = 00;
 5968|    672|        l_mct_data->m_data_size = 0;
 5969|    672|    }
 5970|       |
 5971|  4.26k|    l_mct_data->m_index = l_indix;
 5972|  4.26k|    l_mct_data->m_array_type = (J2K_MCT_ARRAY_TYPE)((l_tmp  >> 8) & 3);
 5973|  4.26k|    l_mct_data->m_element_type = (J2K_MCT_ELEMENT_TYPE)((l_tmp  >> 10) & 3);
 5974|       |
 5975|  4.26k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Ymct */
  ------------------
  |  |   65|  4.26k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5976|  4.26k|    p_header_data += 2;
 5977|  4.26k|    if (l_tmp != 0) {
  ------------------
  |  Branch (5977:9): [True: 3.32k, False: 938]
  ------------------
 5978|  3.32k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  3.32k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5979|  3.32k|                      "Cannot take in charge multiple MCT markers\n");
 5980|  3.32k|        return OPJ_TRUE;
  ------------------
  |  |  117|  3.32k|#define OPJ_TRUE 1
  ------------------
 5981|  3.32k|    }
 5982|       |
 5983|    938|    p_header_size -= 6;
 5984|       |
 5985|    938|    l_mct_data->m_data = (OPJ_BYTE*)opj_malloc(p_header_size);
 5986|    938|    if (! l_mct_data->m_data) {
  ------------------
  |  Branch (5986:9): [True: 0, False: 938]
  ------------------
 5987|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5988|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5989|      0|    }
 5990|    938|    memcpy(l_mct_data->m_data, p_header_data, p_header_size);
 5991|       |
 5992|    938|    l_mct_data->m_data_size = p_header_size;
 5993|       |
 5994|    938|    return OPJ_TRUE;
  ------------------
  |  |  117|    938|#define OPJ_TRUE 1
  ------------------
 5995|    938|}
j2k.c:opj_j2k_read_cbd:
 6643|    140|{
 6644|    140|    OPJ_UINT32 l_nb_comp, l_num_comp;
 6645|    140|    OPJ_UINT32 l_comp_def;
 6646|    140|    OPJ_UINT32 i;
 6647|    140|    opj_image_comp_t * l_comp = 00;
 6648|       |
 6649|       |    /* preconditions */
 6650|    140|    assert(p_header_data != 00);
 6651|    140|    assert(p_j2k != 00);
 6652|    140|    assert(p_manager != 00);
 6653|       |
 6654|    140|    l_num_comp = p_j2k->m_private_image->numcomps;
 6655|       |
 6656|    140|    if (p_header_size != (p_j2k->m_private_image->numcomps + 2)) {
  ------------------
  |  Branch (6656:9): [True: 3, False: 137]
  ------------------
 6657|      3|        opj_event_msg(p_manager, EVT_ERROR, "Crror reading CBD marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6658|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 6659|      3|    }
 6660|       |
 6661|    137|    opj_read_bytes(p_header_data, &l_nb_comp,
  ------------------
  |  |   65|    137|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6662|    137|                   2);                           /* Ncbd */
 6663|    137|    p_header_data += 2;
 6664|       |
 6665|    137|    if (l_nb_comp != l_num_comp) {
  ------------------
  |  Branch (6665:9): [True: 9, False: 128]
  ------------------
 6666|      9|        opj_event_msg(p_manager, EVT_ERROR, "Crror reading CBD marker\n");
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6667|      9|        return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
 6668|      9|    }
 6669|       |
 6670|    128|    l_comp = p_j2k->m_private_image->comps;
 6671|    486|    for (i = 0; i < l_num_comp; ++i) {
  ------------------
  |  Branch (6671:17): [True: 364, False: 122]
  ------------------
 6672|    364|        opj_read_bytes(p_header_data, &l_comp_def,
  ------------------
  |  |   65|    364|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6673|    364|                       1);                  /* Component bit depth */
 6674|    364|        ++p_header_data;
 6675|    364|        l_comp->sgnd = (l_comp_def >> 7) & 1;
 6676|    364|        l_comp->prec = (l_comp_def & 0x7f) + 1;
 6677|       |
 6678|    364|        if (l_comp->prec > 31) {
  ------------------
  |  Branch (6678:13): [True: 6, False: 358]
  ------------------
 6679|      6|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6680|      6|                          "Invalid values for comp = %d : prec=%u (should be between 1 and 38 according to the JPEG2000 norm. OpenJpeg only supports up to 31)\n",
 6681|      6|                          i, l_comp->prec);
 6682|      6|            return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 6683|      6|        }
 6684|    358|        ++l_comp;
 6685|    358|    }
 6686|       |
 6687|    122|    return OPJ_TRUE;
  ------------------
  |  |  117|    122|#define OPJ_TRUE 1
  ------------------
 6688|    128|}
j2k.c:opj_j2k_read_cap:
 6704|     73|{
 6705|       |    /* preconditions */
 6706|     73|    assert(p_header_data != 00);
 6707|     73|    assert(p_j2k != 00);
 6708|     73|    assert(p_manager != 00);
 6709|       |
 6710|     73|    (void)p_j2k;
 6711|     73|    (void)p_header_data;
 6712|     73|    (void)p_header_size;
 6713|     73|    (void)p_manager;
 6714|       |
 6715|     73|    return OPJ_TRUE;
  ------------------
  |  |  117|     73|#define OPJ_TRUE 1
  ------------------
 6716|     73|}
j2k.c:opj_j2k_read_cpf:
 6730|     89|{
 6731|       |    /* preconditions */
 6732|     89|    assert(p_header_data != 00);
 6733|     89|    assert(p_j2k != 00);
 6734|     89|    assert(p_manager != 00);
 6735|       |
 6736|     89|    (void)p_j2k;
 6737|     89|    (void)p_header_data;
 6738|     89|    (void)p_header_size;
 6739|     89|    (void)p_manager;
 6740|       |
 6741|     89|    return OPJ_TRUE;
  ------------------
  |  |  117|     89|#define OPJ_TRUE 1
  ------------------
 6742|     89|}
j2k.c:opj_j2k_read_mcc:
 6116|  6.76k|{
 6117|  6.76k|    OPJ_UINT32 i, j;
 6118|  6.76k|    OPJ_UINT32 l_tmp;
 6119|  6.76k|    OPJ_UINT32 l_indix;
 6120|  6.76k|    opj_tcp_t * l_tcp;
 6121|  6.76k|    opj_simple_mcc_decorrelation_data_t * l_mcc_record;
 6122|  6.76k|    opj_mct_data_t * l_mct_data;
 6123|  6.76k|    OPJ_UINT32 l_nb_collections;
 6124|  6.76k|    OPJ_UINT32 l_nb_comps;
 6125|  6.76k|    OPJ_UINT32 l_nb_bytes_by_comp;
 6126|  6.76k|    OPJ_BOOL l_new_mcc = OPJ_FALSE;
  ------------------
  |  |  118|  6.76k|#define OPJ_FALSE 0
  ------------------
 6127|       |
 6128|       |    /* preconditions */
 6129|  6.76k|    assert(p_header_data != 00);
 6130|  6.76k|    assert(p_j2k != 00);
 6131|  6.76k|    assert(p_manager != 00);
 6132|       |
 6133|  6.76k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (6133:13): [True: 11, False: 6.75k]
  ------------------
 6134|     11|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 6135|  6.76k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 6136|       |
 6137|  6.76k|    if (p_header_size < 2) {
  ------------------
  |  Branch (6137:9): [True: 1, False: 6.76k]
  ------------------
 6138|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6139|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6140|      1|    }
 6141|       |
 6142|       |    /* first marker */
 6143|  6.76k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Zmcc */
  ------------------
  |  |   65|  6.76k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6144|  6.76k|    p_header_data += 2;
 6145|  6.76k|    if (l_tmp != 0) {
  ------------------
  |  Branch (6145:9): [True: 786, False: 5.97k]
  ------------------
 6146|    786|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    786|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6147|    786|                      "Cannot take in charge multiple data spanning\n");
 6148|    786|        return OPJ_TRUE;
  ------------------
  |  |  117|    786|#define OPJ_TRUE 1
  ------------------
 6149|    786|    }
 6150|       |
 6151|  5.97k|    if (p_header_size < 7) {
  ------------------
  |  Branch (6151:9): [True: 1, False: 5.97k]
  ------------------
 6152|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6153|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6154|      1|    }
 6155|       |
 6156|  5.97k|    opj_read_bytes(p_header_data, &l_indix,
  ------------------
  |  |   65|  5.97k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6157|  5.97k|                   1); /* Imcc -> no need for other values, take the first */
 6158|  5.97k|    ++p_header_data;
 6159|       |
 6160|  5.97k|    l_mcc_record = l_tcp->m_mcc_records;
 6161|       |
 6162|  12.4k|    for (i = 0; i < l_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (6162:17): [True: 8.79k, False: 3.67k]
  ------------------
 6163|  8.79k|        if (l_mcc_record->m_index == l_indix) {
  ------------------
  |  Branch (6163:13): [True: 2.29k, False: 6.49k]
  ------------------
 6164|  2.29k|            break;
 6165|  2.29k|        }
 6166|  6.49k|        ++l_mcc_record;
 6167|  6.49k|    }
 6168|       |
 6169|       |    /** NOT FOUND */
 6170|  5.97k|    if (i == l_tcp->m_nb_mcc_records) {
  ------------------
  |  Branch (6170:9): [True: 3.67k, False: 2.29k]
  ------------------
 6171|  3.67k|        if (l_tcp->m_nb_mcc_records == l_tcp->m_nb_max_mcc_records) {
  ------------------
  |  Branch (6171:13): [True: 13, False: 3.66k]
  ------------------
 6172|     13|            opj_simple_mcc_decorrelation_data_t *new_mcc_records;
 6173|     13|            l_tcp->m_nb_max_mcc_records += OPJ_J2K_MCC_DEFAULT_NB_RECORDS;
  ------------------
  |  |  160|     13|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 6174|       |
 6175|     13|            new_mcc_records = (opj_simple_mcc_decorrelation_data_t *) opj_realloc(
 6176|     13|                                  l_tcp->m_mcc_records, l_tcp->m_nb_max_mcc_records * sizeof(
 6177|     13|                                      opj_simple_mcc_decorrelation_data_t));
 6178|     13|            if (! new_mcc_records) {
  ------------------
  |  Branch (6178:17): [True: 0, False: 13]
  ------------------
 6179|      0|                opj_free(l_tcp->m_mcc_records);
 6180|      0|                l_tcp->m_mcc_records = NULL;
 6181|      0|                l_tcp->m_nb_max_mcc_records = 0;
 6182|      0|                l_tcp->m_nb_mcc_records = 0;
 6183|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6184|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6185|      0|            }
 6186|     13|            l_tcp->m_mcc_records = new_mcc_records;
 6187|     13|            l_mcc_record = l_tcp->m_mcc_records + l_tcp->m_nb_mcc_records;
 6188|     13|            memset(l_mcc_record, 0, (l_tcp->m_nb_max_mcc_records - l_tcp->m_nb_mcc_records)
 6189|     13|                   * sizeof(opj_simple_mcc_decorrelation_data_t));
 6190|     13|        }
 6191|  3.67k|        l_mcc_record = l_tcp->m_mcc_records + l_tcp->m_nb_mcc_records;
 6192|  3.67k|        l_new_mcc = OPJ_TRUE;
  ------------------
  |  |  117|  3.67k|#define OPJ_TRUE 1
  ------------------
 6193|  3.67k|    }
 6194|  5.97k|    l_mcc_record->m_index = l_indix;
 6195|       |
 6196|       |    /* only one marker atm */
 6197|  5.97k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Ymcc */
  ------------------
  |  |   65|  5.97k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6198|  5.97k|    p_header_data += 2;
 6199|  5.97k|    if (l_tmp != 0) {
  ------------------
  |  Branch (6199:9): [True: 864, False: 5.11k]
  ------------------
 6200|    864|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    864|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6201|    864|                      "Cannot take in charge multiple data spanning\n");
 6202|    864|        return OPJ_TRUE;
  ------------------
  |  |  117|    864|#define OPJ_TRUE 1
  ------------------
 6203|    864|    }
 6204|       |
 6205|  5.11k|    opj_read_bytes(p_header_data, &l_nb_collections,
  ------------------
  |  |   65|  5.11k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6206|  5.11k|                   2);                              /* Qmcc -> number of collections -> 1 */
 6207|  5.11k|    p_header_data += 2;
 6208|       |
 6209|  5.11k|    if (l_nb_collections > 1) {
  ------------------
  |  Branch (6209:9): [True: 1.29k, False: 3.82k]
  ------------------
 6210|  1.29k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  1.29k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6211|  1.29k|                      "Cannot take in charge multiple collections\n");
 6212|  1.29k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.29k|#define OPJ_TRUE 1
  ------------------
 6213|  1.29k|    }
 6214|       |
 6215|  3.82k|    p_header_size -= 7;
 6216|       |
 6217|  5.05k|    for (i = 0; i < l_nb_collections; ++i) {
  ------------------
  |  Branch (6217:17): [True: 3.17k, False: 1.88k]
  ------------------
 6218|  3.17k|        if (p_header_size < 3) {
  ------------------
  |  Branch (6218:13): [True: 1, False: 3.17k]
  ------------------
 6219|      1|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6220|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6221|      1|        }
 6222|       |
 6223|  3.17k|        opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  3.17k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6224|  3.17k|                       1); /* Xmcci type of component transformation -> array based decorrelation */
 6225|  3.17k|        ++p_header_data;
 6226|       |
 6227|  3.17k|        if (l_tmp != 1) {
  ------------------
  |  Branch (6227:13): [True: 837, False: 2.33k]
  ------------------
 6228|    837|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    837|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6229|    837|                          "Cannot take in charge collections other than array decorrelation\n");
 6230|    837|            return OPJ_TRUE;
  ------------------
  |  |  117|    837|#define OPJ_TRUE 1
  ------------------
 6231|    837|        }
 6232|       |
 6233|  2.33k|        opj_read_bytes(p_header_data, &l_nb_comps, 2);
  ------------------
  |  |   65|  2.33k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6234|       |
 6235|  2.33k|        p_header_data += 2;
 6236|  2.33k|        p_header_size -= 3;
 6237|       |
 6238|  2.33k|        l_nb_bytes_by_comp = 1 + (l_nb_comps >> 15);
 6239|  2.33k|        l_mcc_record->m_nb_comps = l_nb_comps & 0x7fff;
 6240|       |
 6241|  2.33k|        if (p_header_size < (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 2)) {
  ------------------
  |  Branch (6241:13): [True: 6, False: 2.32k]
  ------------------
 6242|      6|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6243|      6|            return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 6244|      6|        }
 6245|       |
 6246|  2.32k|        p_header_size -= (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 2);
 6247|       |
 6248|  4.17k|        for (j = 0; j < l_mcc_record->m_nb_comps; ++j) {
  ------------------
  |  Branch (6248:21): [True: 2.49k, False: 1.68k]
  ------------------
 6249|  2.49k|            opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  2.49k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6250|  2.49k|                           l_nb_bytes_by_comp);      /* Cmccij Component offset*/
 6251|  2.49k|            p_header_data += l_nb_bytes_by_comp;
 6252|       |
 6253|  2.49k|            if (l_tmp != j) {
  ------------------
  |  Branch (6253:17): [True: 647, False: 1.84k]
  ------------------
 6254|    647|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    647|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6255|    647|                              "Cannot take in charge collections with indix shuffle\n");
 6256|    647|                return OPJ_TRUE;
  ------------------
  |  |  117|    647|#define OPJ_TRUE 1
  ------------------
 6257|    647|            }
 6258|  2.49k|        }
 6259|       |
 6260|  1.68k|        opj_read_bytes(p_header_data, &l_nb_comps, 2);
  ------------------
  |  |   65|  1.68k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6261|  1.68k|        p_header_data += 2;
 6262|       |
 6263|  1.68k|        l_nb_bytes_by_comp = 1 + (l_nb_comps >> 15);
 6264|  1.68k|        l_nb_comps &= 0x7fff;
 6265|       |
 6266|  1.68k|        if (l_nb_comps != l_mcc_record->m_nb_comps) {
  ------------------
  |  Branch (6266:13): [True: 392, False: 1.29k]
  ------------------
 6267|    392|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    392|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6268|    392|                          "Cannot take in charge collections without same number of indixes\n");
 6269|    392|            return OPJ_TRUE;
  ------------------
  |  |  117|    392|#define OPJ_TRUE 1
  ------------------
 6270|    392|        }
 6271|       |
 6272|  1.29k|        if (p_header_size < (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 3)) {
  ------------------
  |  Branch (6272:13): [True: 1, False: 1.28k]
  ------------------
 6273|      1|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6274|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6275|      1|        }
 6276|       |
 6277|  1.28k|        p_header_size -= (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 3);
 6278|       |
 6279|  1.57k|        for (j = 0; j < l_mcc_record->m_nb_comps; ++j) {
  ------------------
  |  Branch (6279:21): [True: 329, False: 1.24k]
  ------------------
 6280|    329|            opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|    329|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6281|    329|                           l_nb_bytes_by_comp);      /* Wmccij Component offset*/
 6282|    329|            p_header_data += l_nb_bytes_by_comp;
 6283|       |
 6284|    329|            if (l_tmp != j) {
  ------------------
  |  Branch (6284:17): [True: 42, False: 287]
  ------------------
 6285|     42|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     42|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6286|     42|                              "Cannot take in charge collections with indix shuffle\n");
 6287|     42|                return OPJ_TRUE;
  ------------------
  |  |  117|     42|#define OPJ_TRUE 1
  ------------------
 6288|     42|            }
 6289|    329|        }
 6290|       |
 6291|  1.24k|        opj_read_bytes(p_header_data, &l_tmp, 3); /* Wmccij Component offset*/
  ------------------
  |  |   65|  1.24k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6292|  1.24k|        p_header_data += 3;
 6293|       |
 6294|  1.24k|        l_mcc_record->m_is_irreversible = !((l_tmp >> 16) & 1);
 6295|  1.24k|        l_mcc_record->m_decorrelation_array = 00;
 6296|  1.24k|        l_mcc_record->m_offset_array = 00;
 6297|       |
 6298|  1.24k|        l_indix = l_tmp & 0xff;
 6299|  1.24k|        if (l_indix != 0) {
  ------------------
  |  Branch (6299:13): [True: 998, False: 249]
  ------------------
 6300|    998|            l_mct_data = l_tcp->m_mct_records;
 6301|  3.76k|            for (j = 0; j < l_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (6301:25): [True: 3.75k, False: 6]
  ------------------
 6302|  3.75k|                if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (6302:21): [True: 992, False: 2.76k]
  ------------------
 6303|    992|                    l_mcc_record->m_decorrelation_array = l_mct_data;
 6304|    992|                    break;
 6305|    992|                }
 6306|  2.76k|                ++l_mct_data;
 6307|  2.76k|            }
 6308|       |
 6309|    998|            if (l_mcc_record->m_decorrelation_array == 00) {
  ------------------
  |  Branch (6309:17): [True: 6, False: 992]
  ------------------
 6310|      6|                opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6311|      6|                return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 6312|      6|            }
 6313|    998|        }
 6314|       |
 6315|  1.24k|        l_indix = (l_tmp >> 8) & 0xff;
 6316|  1.24k|        if (l_indix != 0) {
  ------------------
  |  Branch (6316:13): [True: 1.07k, False: 162]
  ------------------
 6317|  1.07k|            l_mct_data = l_tcp->m_mct_records;
 6318|  3.84k|            for (j = 0; j < l_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (6318:25): [True: 3.83k, False: 9]
  ------------------
 6319|  3.83k|                if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (6319:21): [True: 1.07k, False: 2.76k]
  ------------------
 6320|  1.07k|                    l_mcc_record->m_offset_array = l_mct_data;
 6321|  1.07k|                    break;
 6322|  1.07k|                }
 6323|  2.76k|                ++l_mct_data;
 6324|  2.76k|            }
 6325|       |
 6326|  1.07k|            if (l_mcc_record->m_offset_array == 00) {
  ------------------
  |  Branch (6326:17): [True: 9, False: 1.07k]
  ------------------
 6327|      9|                opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6328|      9|                return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
 6329|      9|            }
 6330|  1.07k|        }
 6331|  1.24k|    }
 6332|       |
 6333|  1.88k|    if (p_header_size != 0) {
  ------------------
  |  Branch (6333:9): [True: 1, False: 1.87k]
  ------------------
 6334|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6335|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6336|      1|    }
 6337|       |
 6338|  1.87k|    if (l_new_mcc) {
  ------------------
  |  Branch (6338:9): [True: 498, False: 1.38k]
  ------------------
 6339|    498|        ++l_tcp->m_nb_mcc_records;
 6340|    498|    }
 6341|       |
 6342|  1.87k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.87k|#define OPJ_TRUE 1
  ------------------
 6343|  1.88k|}
j2k.c:opj_j2k_read_mco:
 6421|  37.9k|{
 6422|  37.9k|    OPJ_UINT32 l_tmp, i;
 6423|  37.9k|    OPJ_UINT32 l_nb_stages;
 6424|  37.9k|    opj_tcp_t * l_tcp;
 6425|  37.9k|    opj_tccp_t * l_tccp;
 6426|  37.9k|    opj_image_t * l_image;
 6427|       |
 6428|       |    /* preconditions */
 6429|  37.9k|    assert(p_header_data != 00);
 6430|  37.9k|    assert(p_j2k != 00);
 6431|  37.9k|    assert(p_manager != 00);
 6432|       |
 6433|  37.9k|    l_image = p_j2k->m_private_image;
 6434|  37.9k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (6434:13): [True: 13, False: 37.9k]
  ------------------
 6435|     13|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 6436|  37.9k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 6437|       |
 6438|  37.9k|    if (p_header_size < 1) {
  ------------------
  |  Branch (6438:9): [True: 2, False: 37.9k]
  ------------------
 6439|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCO marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6440|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 6441|      2|    }
 6442|       |
 6443|  37.9k|    opj_read_bytes(p_header_data, &l_nb_stages,
  ------------------
  |  |   65|  37.9k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6444|  37.9k|                   1);                         /* Nmco : only one transform stage*/
 6445|  37.9k|    ++p_header_data;
 6446|       |
 6447|  37.9k|    if (l_nb_stages > 1) {
  ------------------
  |  Branch (6447:9): [True: 33.9k, False: 3.94k]
  ------------------
 6448|  33.9k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  33.9k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6449|  33.9k|                      "Cannot take in charge multiple transformation stages.\n");
 6450|  33.9k|        return OPJ_TRUE;
  ------------------
  |  |  117|  33.9k|#define OPJ_TRUE 1
  ------------------
 6451|  33.9k|    }
 6452|       |
 6453|  3.94k|    if (p_header_size != l_nb_stages + 1) {
  ------------------
  |  Branch (6453:9): [True: 8, False: 3.93k]
  ------------------
 6454|      8|        opj_event_msg(p_manager, EVT_WARNING, "Error reading MCO marker\n");
  ------------------
  |  |   67|      8|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6455|      8|        return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
 6456|      8|    }
 6457|       |
 6458|  3.93k|    l_tccp = l_tcp->tccps;
 6459|       |
 6460|  15.8k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (6460:17): [True: 11.9k, False: 3.93k]
  ------------------
 6461|  11.9k|        l_tccp->m_dc_level_shift = 0;
 6462|  11.9k|        ++l_tccp;
 6463|  11.9k|    }
 6464|       |
 6465|  3.93k|    if (l_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (6465:9): [True: 1.93k, False: 2.00k]
  ------------------
 6466|  1.93k|        opj_free(l_tcp->m_mct_decoding_matrix);
 6467|  1.93k|        l_tcp->m_mct_decoding_matrix = 00;
 6468|  1.93k|    }
 6469|       |
 6470|  7.63k|    for (i = 0; i < l_nb_stages; ++i) {
  ------------------
  |  Branch (6470:17): [True: 3.70k, False: 3.93k]
  ------------------
 6471|  3.70k|        opj_read_bytes(p_header_data, &l_tmp, 1);
  ------------------
  |  |   65|  3.70k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6472|  3.70k|        ++p_header_data;
 6473|       |
 6474|  3.70k|        if (! opj_j2k_add_mct(l_tcp, p_j2k->m_private_image, l_tmp)) {
  ------------------
  |  Branch (6474:13): [True: 3, False: 3.69k]
  ------------------
 6475|      3|            return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 6476|      3|        }
 6477|  3.70k|    }
 6478|       |
 6479|  3.93k|    return OPJ_TRUE;
  ------------------
  |  |  117|  3.93k|#define OPJ_TRUE 1
  ------------------
 6480|  3.93k|}
j2k.c:opj_j2k_add_mct:
 6484|  3.70k|{
 6485|  3.70k|    OPJ_UINT32 i;
 6486|  3.70k|    opj_simple_mcc_decorrelation_data_t * l_mcc_record;
 6487|  3.70k|    opj_mct_data_t * l_deco_array, * l_offset_array;
 6488|  3.70k|    OPJ_UINT32 l_data_size, l_mct_size, l_offset_size;
 6489|  3.70k|    OPJ_UINT32 l_nb_elem;
 6490|  3.70k|    OPJ_UINT32 * l_offset_data, * l_current_offset_data;
 6491|  3.70k|    opj_tccp_t * l_tccp;
 6492|       |
 6493|       |    /* preconditions */
 6494|  3.70k|    assert(p_tcp != 00);
 6495|       |
 6496|  3.70k|    l_mcc_record = p_tcp->m_mcc_records;
 6497|       |
 6498|  3.82k|    for (i = 0; i < p_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (6498:17): [True: 2.91k, False: 909]
  ------------------
 6499|  2.91k|        if (l_mcc_record->m_index == p_index) {
  ------------------
  |  Branch (6499:13): [True: 2.79k, False: 123]
  ------------------
 6500|  2.79k|            break;
 6501|  2.79k|        }
 6502|  2.91k|    }
 6503|       |
 6504|  3.70k|    if (i == p_tcp->m_nb_mcc_records) {
  ------------------
  |  Branch (6504:9): [True: 909, False: 2.79k]
  ------------------
 6505|       |        /** element discarded **/
 6506|    909|        return OPJ_TRUE;
  ------------------
  |  |  117|    909|#define OPJ_TRUE 1
  ------------------
 6507|    909|    }
 6508|       |
 6509|  2.79k|    if (l_mcc_record->m_nb_comps != p_image->numcomps) {
  ------------------
  |  Branch (6509:9): [True: 215, False: 2.57k]
  ------------------
 6510|       |        /** do not support number of comps != image */
 6511|    215|        return OPJ_TRUE;
  ------------------
  |  |  117|    215|#define OPJ_TRUE 1
  ------------------
 6512|    215|    }
 6513|       |
 6514|  2.57k|    l_deco_array = l_mcc_record->m_decorrelation_array;
 6515|       |
 6516|  2.57k|    if (l_deco_array) {
  ------------------
  |  Branch (6516:9): [True: 1.99k, False: 579]
  ------------------
 6517|  1.99k|        l_data_size = MCT_ELEMENT_SIZE[l_deco_array->m_element_type] * p_image->numcomps
 6518|  1.99k|                      * p_image->numcomps;
 6519|  1.99k|        if (l_deco_array->m_data_size != l_data_size) {
  ------------------
  |  Branch (6519:13): [True: 1, False: 1.99k]
  ------------------
 6520|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6521|      1|        }
 6522|       |
 6523|  1.99k|        l_nb_elem = p_image->numcomps * p_image->numcomps;
 6524|  1.99k|        l_mct_size = l_nb_elem * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
 6525|  1.99k|        p_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(l_mct_size);
 6526|       |
 6527|  1.99k|        if (! p_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (6527:13): [True: 0, False: 1.99k]
  ------------------
 6528|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6529|      0|        }
 6530|       |
 6531|  1.99k|        j2k_mct_read_functions_to_float[l_deco_array->m_element_type](
 6532|  1.99k|            l_deco_array->m_data, p_tcp->m_mct_decoding_matrix, l_nb_elem);
 6533|  1.99k|    }
 6534|       |
 6535|  2.57k|    l_offset_array = l_mcc_record->m_offset_array;
 6536|       |
 6537|  2.57k|    if (l_offset_array) {
  ------------------
  |  Branch (6537:9): [True: 718, False: 1.85k]
  ------------------
 6538|    718|        l_data_size = MCT_ELEMENT_SIZE[l_offset_array->m_element_type] *
 6539|    718|                      p_image->numcomps;
 6540|    718|        if (l_offset_array->m_data_size != l_data_size) {
  ------------------
  |  Branch (6540:13): [True: 2, False: 716]
  ------------------
 6541|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 6542|      2|        }
 6543|       |
 6544|    716|        l_nb_elem = p_image->numcomps;
 6545|    716|        l_offset_size = l_nb_elem * (OPJ_UINT32)sizeof(OPJ_UINT32);
 6546|    716|        l_offset_data = (OPJ_UINT32*)opj_malloc(l_offset_size);
 6547|       |
 6548|    716|        if (! l_offset_data) {
  ------------------
  |  Branch (6548:13): [True: 0, False: 716]
  ------------------
 6549|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6550|      0|        }
 6551|       |
 6552|    716|        j2k_mct_read_functions_to_int32[l_offset_array->m_element_type](
 6553|    716|            l_offset_array->m_data, l_offset_data, l_nb_elem);
 6554|       |
 6555|    716|        l_tccp = p_tcp->tccps;
 6556|    716|        l_current_offset_data = l_offset_data;
 6557|       |
 6558|  1.99k|        for (i = 0; i < p_image->numcomps; ++i) {
  ------------------
  |  Branch (6558:21): [True: 1.27k, False: 716]
  ------------------
 6559|  1.27k|            l_tccp->m_dc_level_shift = (OPJ_INT32) * (l_current_offset_data++);
 6560|  1.27k|            ++l_tccp;
 6561|  1.27k|        }
 6562|       |
 6563|    716|        opj_free(l_offset_data);
 6564|    716|    }
 6565|       |
 6566|  2.57k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.57k|#define OPJ_TRUE 1
  ------------------
 6567|  2.57k|}
j2k.c:opj_j2k_read_int16_to_float:
 1449|    563|{
 1450|    563|    OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data;
 1451|    563|    OPJ_FLOAT32 * l_dest_data = (OPJ_FLOAT32 *) p_dest_data;
 1452|    563|    OPJ_UINT32 i;
 1453|    563|    OPJ_UINT32 l_temp;
 1454|       |
 1455|  2.79k|    for (i = 0; i < p_nb_elem; ++i) {
  ------------------
  |  Branch (1455:17): [True: 2.23k, False: 563]
  ------------------
 1456|  2.23k|        opj_read_bytes(l_src_data, &l_temp, 2);
  ------------------
  |  |   65|  2.23k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1457|       |
 1458|  2.23k|        l_src_data += sizeof(OPJ_INT16);
 1459|       |
 1460|  2.23k|        *(l_dest_data++) = (OPJ_FLOAT32) l_temp;
 1461|  2.23k|    }
 1462|    563|}
j2k.c:opj_j2k_read_int32_to_float:
 1466|    545|{
 1467|    545|    OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data;
 1468|    545|    OPJ_FLOAT32 * l_dest_data = (OPJ_FLOAT32 *) p_dest_data;
 1469|    545|    OPJ_UINT32 i;
 1470|    545|    OPJ_UINT32 l_temp;
 1471|       |
 1472|  2.55k|    for (i = 0; i < p_nb_elem; ++i) {
  ------------------
  |  Branch (1472:17): [True: 2.01k, False: 545]
  ------------------
 1473|  2.01k|        opj_read_bytes(l_src_data, &l_temp, 4);
  ------------------
  |  |   65|  2.01k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1474|       |
 1475|  2.01k|        l_src_data += sizeof(OPJ_INT32);
 1476|       |
 1477|  2.01k|        *(l_dest_data++) = (OPJ_FLOAT32) l_temp;
 1478|  2.01k|    }
 1479|    545|}
j2k.c:opj_j2k_read_float32_to_float:
 1483|    456|{
 1484|    456|    OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data;
 1485|    456|    OPJ_FLOAT32 * l_dest_data = (OPJ_FLOAT32 *) p_dest_data;
 1486|    456|    OPJ_UINT32 i;
 1487|    456|    OPJ_FLOAT32 l_temp;
 1488|       |
 1489|  2.04k|    for (i = 0; i < p_nb_elem; ++i) {
  ------------------
  |  Branch (1489:17): [True: 1.59k, False: 456]
  ------------------
 1490|  1.59k|        opj_read_float(l_src_data, &l_temp);
  ------------------
  |  |   69|  1.59k|#define opj_read_float      opj_read_float_LE
  ------------------
 1491|       |
 1492|  1.59k|        l_src_data += sizeof(OPJ_FLOAT32);
 1493|       |
 1494|  1.59k|        *(l_dest_data++) = l_temp;
 1495|  1.59k|    }
 1496|    456|}
j2k.c:opj_j2k_read_float64_to_float:
 1500|    432|{
 1501|    432|    OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data;
 1502|    432|    OPJ_FLOAT32 * l_dest_data = (OPJ_FLOAT32 *) p_dest_data;
 1503|    432|    OPJ_UINT32 i;
 1504|    432|    OPJ_FLOAT64 l_temp;
 1505|       |
 1506|  2.14k|    for (i = 0; i < p_nb_elem; ++i) {
  ------------------
  |  Branch (1506:17): [True: 1.71k, False: 432]
  ------------------
 1507|  1.71k|        opj_read_double(l_src_data, &l_temp);
  ------------------
  |  |   67|  1.71k|#define opj_read_double     opj_read_double_LE
  ------------------
 1508|       |
 1509|  1.71k|        l_src_data += sizeof(OPJ_FLOAT64);
 1510|       |
 1511|  1.71k|        *(l_dest_data++) = (OPJ_FLOAT32) l_temp;
 1512|  1.71k|    }
 1513|    432|}
j2k.c:opj_j2k_read_int16_to_int32:
 1517|     52|{
 1518|     52|    OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data;
 1519|     52|    OPJ_INT32 * l_dest_data = (OPJ_INT32 *) p_dest_data;
 1520|     52|    OPJ_UINT32 i;
 1521|     52|    OPJ_UINT32 l_temp;
 1522|       |
 1523|    150|    for (i = 0; i < p_nb_elem; ++i) {
  ------------------
  |  Branch (1523:17): [True: 98, False: 52]
  ------------------
 1524|     98|        opj_read_bytes(l_src_data, &l_temp, 2);
  ------------------
  |  |   65|     98|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1525|       |
 1526|     98|        l_src_data += sizeof(OPJ_INT16);
 1527|       |
 1528|     98|        *(l_dest_data++) = (OPJ_INT32) l_temp;
 1529|     98|    }
 1530|     52|}
j2k.c:opj_j2k_read_int32_to_int32:
 1534|    125|{
 1535|    125|    OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data;
 1536|    125|    OPJ_INT32 * l_dest_data = (OPJ_INT32 *) p_dest_data;
 1537|    125|    OPJ_UINT32 i;
 1538|    125|    OPJ_UINT32 l_temp;
 1539|       |
 1540|    324|    for (i = 0; i < p_nb_elem; ++i) {
  ------------------
  |  Branch (1540:17): [True: 199, False: 125]
  ------------------
 1541|    199|        opj_read_bytes(l_src_data, &l_temp, 4);
  ------------------
  |  |   65|    199|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1542|       |
 1543|    199|        l_src_data += sizeof(OPJ_INT32);
 1544|       |
 1545|    199|        *(l_dest_data++) = (OPJ_INT32) l_temp;
 1546|    199|    }
 1547|    125|}
j2k.c:opj_j2k_read_float32_to_int32:
 1551|    392|{
 1552|    392|    OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data;
 1553|    392|    OPJ_INT32 * l_dest_data = (OPJ_INT32 *) p_dest_data;
 1554|    392|    OPJ_UINT32 i;
 1555|    392|    OPJ_FLOAT32 l_temp;
 1556|       |
 1557|  1.07k|    for (i = 0; i < p_nb_elem; ++i) {
  ------------------
  |  Branch (1557:17): [True: 686, False: 392]
  ------------------
 1558|    686|        opj_read_float(l_src_data, &l_temp);
  ------------------
  |  |   69|    686|#define opj_read_float      opj_read_float_LE
  ------------------
 1559|       |
 1560|    686|        l_src_data += sizeof(OPJ_FLOAT32);
 1561|       |
 1562|    686|        *(l_dest_data++) = (OPJ_INT32) l_temp;
 1563|    686|    }
 1564|    392|}
j2k.c:opj_j2k_read_float64_to_int32:
 1568|    147|{
 1569|    147|    OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data;
 1570|    147|    OPJ_INT32 * l_dest_data = (OPJ_INT32 *) p_dest_data;
 1571|    147|    OPJ_UINT32 i;
 1572|    147|    OPJ_FLOAT64 l_temp;
 1573|       |
 1574|    438|    for (i = 0; i < p_nb_elem; ++i) {
  ------------------
  |  Branch (1574:17): [True: 291, False: 147]
  ------------------
 1575|    291|        opj_read_double(l_src_data, &l_temp);
  ------------------
  |  |   67|    291|#define opj_read_double     opj_read_double_LE
  ------------------
 1576|       |
 1577|    291|        l_src_data += sizeof(OPJ_FLOAT64);
 1578|       |
 1579|    291|        *(l_dest_data++) = (OPJ_INT32) l_temp;
 1580|    291|    }
 1581|    147|}
j2k.c:opj_j2k_add_tlmarker:
 8416|  17.6k|{
 8417|  17.6k|    assert(cstr_index != 00);
 8418|  17.6k|    assert(cstr_index->tile_index != 00);
 8419|       |
 8420|       |    /* expand the list? */
 8421|  17.6k|    if ((cstr_index->tile_index[tileno].marknum + 1) >
  ------------------
  |  Branch (8421:9): [True: 12, False: 17.6k]
  ------------------
 8422|  17.6k|            cstr_index->tile_index[tileno].maxmarknum) {
 8423|     12|        opj_marker_info_t *new_marker;
 8424|     12|        cstr_index->tile_index[tileno].maxmarknum = (OPJ_UINT32)(100 +
 8425|     12|                (OPJ_FLOAT32) cstr_index->tile_index[tileno].maxmarknum);
 8426|     12|        new_marker = (opj_marker_info_t *) opj_realloc(
 8427|     12|                         cstr_index->tile_index[tileno].marker,
 8428|     12|                         cstr_index->tile_index[tileno].maxmarknum * sizeof(opj_marker_info_t));
 8429|     12|        if (! new_marker) {
  ------------------
  |  Branch (8429:13): [True: 0, False: 12]
  ------------------
 8430|      0|            opj_free(cstr_index->tile_index[tileno].marker);
 8431|      0|            cstr_index->tile_index[tileno].marker = NULL;
 8432|      0|            cstr_index->tile_index[tileno].maxmarknum = 0;
 8433|      0|            cstr_index->tile_index[tileno].marknum = 0;
 8434|       |            /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add tl marker\n"); */
 8435|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8436|      0|        }
 8437|     12|        cstr_index->tile_index[tileno].marker = new_marker;
 8438|     12|    }
 8439|       |
 8440|       |    /* add the marker */
 8441|  17.6k|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].type
 8442|  17.6k|        = (OPJ_UINT16)type;
 8443|  17.6k|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].pos
 8444|  17.6k|        = (OPJ_INT32)pos;
 8445|  17.6k|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].len
 8446|  17.6k|        = (OPJ_INT32)len;
 8447|  17.6k|    cstr_index->tile_index[tileno].marknum++;
 8448|       |
 8449|  17.6k|    if (type == J2K_MS_SOT) {
  ------------------
  |  |   73|  17.6k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (8449:9): [True: 8.03k, False: 9.65k]
  ------------------
 8450|  8.03k|        OPJ_UINT32 l_current_tile_part = cstr_index->tile_index[tileno].current_tpsno;
 8451|       |
 8452|  8.03k|        if (cstr_index->tile_index[tileno].tp_index) {
  ------------------
  |  Branch (8452:13): [True: 8.03k, False: 0]
  ------------------
 8453|  8.03k|            cstr_index->tile_index[tileno].tp_index[l_current_tile_part].start_pos = pos;
 8454|  8.03k|        }
 8455|       |
 8456|  8.03k|    }
 8457|  17.6k|    return OPJ_TRUE;
  ------------------
  |  |  117|  17.6k|#define OPJ_TRUE 1
  ------------------
 8458|  17.6k|}
j2k.c:opj_j2k_read_sod:
 4982|  9.25k|{
 4983|  9.25k|    OPJ_SIZE_T l_current_read_size;
 4984|  9.25k|    opj_codestream_index_t * l_cstr_index = 00;
 4985|  9.25k|    OPJ_BYTE ** l_current_data = 00;
 4986|  9.25k|    opj_tcp_t * l_tcp = 00;
 4987|  9.25k|    OPJ_UINT32 * l_tile_len = 00;
 4988|  9.25k|    OPJ_BOOL l_sot_length_pb_detected = OPJ_FALSE;
  ------------------
  |  |  118|  9.25k|#define OPJ_FALSE 0
  ------------------
 4989|       |
 4990|       |    /* preconditions */
 4991|  9.25k|    assert(p_j2k != 00);
 4992|  9.25k|    assert(p_manager != 00);
 4993|  9.25k|    assert(p_stream != 00);
 4994|       |
 4995|  9.25k|    l_tcp = &(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);
 4996|       |
 4997|  9.25k|    if (p_j2k->m_specific_param.m_decoder.m_last_tile_part) {
  ------------------
  |  Branch (4997:9): [True: 6.38k, False: 2.86k]
  ------------------
 4998|       |        /* opj_stream_get_number_byte_left returns OPJ_OFF_T
 4999|       |        // but we are in the last tile part,
 5000|       |        // so its result will fit on OPJ_UINT32 unless we find
 5001|       |        // a file with a single tile part of more than 4 GB...*/
 5002|  6.38k|        p_j2k->m_specific_param.m_decoder.m_sot_length = (OPJ_UINT32)(
 5003|  6.38k|                    opj_stream_get_number_byte_left(p_stream) - 2);
 5004|  6.38k|    } else {
 5005|       |        /* Check to avoid pass the limit of OPJ_UINT32 */
 5006|  2.86k|        if (p_j2k->m_specific_param.m_decoder.m_sot_length >= 2) {
  ------------------
  |  Branch (5006:13): [True: 1.39k, False: 1.47k]
  ------------------
 5007|  1.39k|            p_j2k->m_specific_param.m_decoder.m_sot_length -= 2;
 5008|  1.47k|        } else {
 5009|       |            /* MSD: case commented to support empty SOT marker (PHR data) */
 5010|  1.47k|        }
 5011|  2.86k|    }
 5012|       |
 5013|  9.25k|    l_current_data = &(l_tcp->m_data);
 5014|  9.25k|    l_tile_len = &l_tcp->m_data_size;
 5015|       |
 5016|       |    /* Patch to support new PHR data */
 5017|  9.25k|    if (p_j2k->m_specific_param.m_decoder.m_sot_length) {
  ------------------
  |  Branch (5017:9): [True: 7.75k, False: 1.49k]
  ------------------
 5018|       |        /* If we are here, we'll try to read the data after allocation */
 5019|       |        /* Check enough bytes left in stream before allocation */
 5020|  7.75k|        if ((OPJ_OFF_T)p_j2k->m_specific_param.m_decoder.m_sot_length >
  ------------------
  |  Branch (5020:13): [True: 66, False: 7.69k]
  ------------------
 5021|  7.75k|                opj_stream_get_number_byte_left(p_stream)) {
 5022|     66|            if (p_j2k->m_cp.strict) {
  ------------------
  |  Branch (5022:17): [True: 66, False: 0]
  ------------------
 5023|     66|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     66|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5024|     66|                              "Tile part length size inconsistent with stream length\n");
 5025|     66|                return OPJ_FALSE;
  ------------------
  |  |  118|     66|#define OPJ_FALSE 0
  ------------------
 5026|     66|            } else {
 5027|      0|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5028|      0|                              "Tile part length size inconsistent with stream length\n");
 5029|      0|            }
 5030|     66|        }
 5031|  7.69k|        if (p_j2k->m_specific_param.m_decoder.m_sot_length >
  ------------------
  |  Branch (5031:13): [True: 0, False: 7.69k]
  ------------------
 5032|  7.69k|                UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA) {
  ------------------
  |  |   39|  7.69k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 5033|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5034|      0|                          "p_j2k->m_specific_param.m_decoder.m_sot_length > "
 5035|      0|                          "UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA");
 5036|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5037|      0|        }
 5038|       |        /* Add a margin of OPJ_COMMON_CBLK_DATA_EXTRA to the allocation we */
 5039|       |        /* do so that opj_mqc_init_dec_common() can safely add a synthetic */
 5040|       |        /* 0xFFFF marker. */
 5041|  7.69k|        if (! *l_current_data) {
  ------------------
  |  Branch (5041:13): [True: 7.55k, False: 134]
  ------------------
 5042|       |            /* LH: oddly enough, in this path, l_tile_len!=0.
 5043|       |             * TODO: If this was consistent, we could simplify the code to only use realloc(), as realloc(0,...) default to malloc(0,...).
 5044|       |             */
 5045|  7.55k|            *l_current_data = (OPJ_BYTE*) opj_malloc(
 5046|  7.55k|                                  p_j2k->m_specific_param.m_decoder.m_sot_length + OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  7.55k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 5047|  7.55k|        } else {
 5048|    134|            OPJ_BYTE *l_new_current_data;
 5049|    134|            if (*l_tile_len > UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA -
  ------------------
  |  |   39|    134|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  |  Branch (5049:17): [True: 0, False: 134]
  ------------------
 5050|    134|                    p_j2k->m_specific_param.m_decoder.m_sot_length) {
 5051|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5052|      0|                              "*l_tile_len > UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA - "
 5053|      0|                              "p_j2k->m_specific_param.m_decoder.m_sot_length");
 5054|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5055|      0|            }
 5056|       |
 5057|    134|            l_new_current_data = (OPJ_BYTE *) opj_realloc(*l_current_data,
 5058|    134|                                 *l_tile_len + p_j2k->m_specific_param.m_decoder.m_sot_length +
 5059|    134|                                 OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|    134|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 5060|    134|            if (! l_new_current_data) {
  ------------------
  |  Branch (5060:17): [True: 0, False: 134]
  ------------------
 5061|      0|                opj_free(*l_current_data);
 5062|       |                /*nothing more is done as l_current_data will be set to null, and just
 5063|       |                  afterward we enter in the error path
 5064|       |                  and the actual tile_len is updated (committed) at the end of the
 5065|       |                  function. */
 5066|      0|            }
 5067|    134|            *l_current_data = l_new_current_data;
 5068|    134|        }
 5069|       |
 5070|  7.69k|        if (*l_current_data == 00) {
  ------------------
  |  Branch (5070:13): [True: 0, False: 7.69k]
  ------------------
 5071|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to decode tile\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5072|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5073|      0|        }
 5074|  7.69k|    } else {
 5075|  1.49k|        l_sot_length_pb_detected = OPJ_TRUE;
  ------------------
  |  |  117|  1.49k|#define OPJ_TRUE 1
  ------------------
 5076|  1.49k|    }
 5077|       |
 5078|       |    /* Index */
 5079|  9.19k|    l_cstr_index = p_j2k->cstr_index;
 5080|  9.19k|    {
 5081|  9.19k|        OPJ_OFF_T l_current_pos = opj_stream_tell(p_stream) - 2;
 5082|       |
 5083|  9.19k|        OPJ_UINT32 l_current_tile_part =
 5084|  9.19k|            l_cstr_index->tile_index[p_j2k->m_current_tile_number].current_tpsno;
 5085|  9.19k|        l_cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index[l_current_tile_part].end_header
 5086|  9.19k|            =
 5087|  9.19k|                l_current_pos;
 5088|  9.19k|        l_cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index[l_current_tile_part].end_pos
 5089|  9.19k|            =
 5090|  9.19k|                l_current_pos + p_j2k->m_specific_param.m_decoder.m_sot_length + 2;
 5091|       |
 5092|  9.19k|        if (OPJ_FALSE == opj_j2k_add_tlmarker(p_j2k->m_current_tile_number,
  ------------------
  |  |  118|  9.19k|#define OPJ_FALSE 0
  ------------------
  |  Branch (5092:13): [True: 0, False: 9.19k]
  ------------------
 5093|  9.19k|                                              l_cstr_index,
 5094|  9.19k|                                              J2K_MS_SOD,
  ------------------
  |  |   74|  9.19k|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
 5095|  9.19k|                                              l_current_pos,
 5096|  9.19k|                                              p_j2k->m_specific_param.m_decoder.m_sot_length + 2)) {
 5097|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add tl marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5098|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5099|      0|        }
 5100|       |
 5101|       |        /*l_cstr_index->packno = 0;*/
 5102|  9.19k|    }
 5103|       |
 5104|       |    /* Patch to support new PHR data */
 5105|  9.19k|    if (!l_sot_length_pb_detected) {
  ------------------
  |  Branch (5105:9): [True: 7.69k, False: 1.49k]
  ------------------
 5106|  7.69k|        l_current_read_size = opj_stream_read_data(
 5107|  7.69k|                                  p_stream,
 5108|  7.69k|                                  *l_current_data + *l_tile_len,
 5109|  7.69k|                                  p_j2k->m_specific_param.m_decoder.m_sot_length,
 5110|  7.69k|                                  p_manager);
 5111|  7.69k|    } else {
 5112|  1.49k|        l_current_read_size = 0;
 5113|  1.49k|    }
 5114|       |
 5115|  9.19k|    if (l_current_read_size != p_j2k->m_specific_param.m_decoder.m_sot_length) {
  ------------------
  |  Branch (5115:9): [True: 0, False: 9.19k]
  ------------------
 5116|      0|        if (l_current_read_size == (OPJ_SIZE_T)(-1)) {
  ------------------
  |  Branch (5116:13): [True: 0, False: 0]
  ------------------
 5117|       |            /* Avoid issue of https://github.com/uclouvain/openjpeg/issues/1533 */
 5118|      0|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5119|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5120|      0|        }
 5121|      0|        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 5122|  9.19k|    } else {
 5123|  9.19k|        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 5124|  9.19k|    }
 5125|       |
 5126|  9.19k|    *l_tile_len += (OPJ_UINT32)l_current_read_size;
 5127|       |
 5128|  9.19k|    return OPJ_TRUE;
  ------------------
  |  |  117|  9.19k|#define OPJ_TRUE 1
  ------------------
 5129|  9.19k|}
j2k.c:opj_j2k_need_nb_tile_parts_correction:
 9583|    674|{
 9584|    674|    OPJ_BYTE   l_header_data[10];
 9585|    674|    OPJ_OFF_T  l_stream_pos_backup;
 9586|    674|    OPJ_UINT32 l_current_marker;
 9587|    674|    OPJ_UINT32 l_marker_size;
 9588|    674|    OPJ_UINT32 l_tile_no, l_tot_len, l_current_part, l_num_parts;
 9589|       |
 9590|       |    /* initialize to no correction needed */
 9591|    674|    *p_correction_needed = OPJ_FALSE;
  ------------------
  |  |  118|    674|#define OPJ_FALSE 0
  ------------------
 9592|       |
 9593|    674|    if (!opj_stream_has_seek(p_stream)) {
  ------------------
  |  Branch (9593:9): [True: 0, False: 674]
  ------------------
 9594|       |        /* We can't do much in this case, seek is needed */
 9595|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9596|      0|    }
 9597|       |
 9598|    674|    l_stream_pos_backup = opj_stream_tell(p_stream);
 9599|    674|    if (l_stream_pos_backup == -1) {
  ------------------
  |  Branch (9599:9): [True: 0, False: 674]
  ------------------
 9600|       |        /* let's do nothing */
 9601|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9602|      0|    }
 9603|       |
 9604|  3.36k|    for (;;) {
 9605|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 9606|  3.36k|        if (opj_stream_read_data(p_stream, l_header_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (9606:13): [True: 52, False: 3.31k]
  ------------------
 9607|       |            /* assume all is OK */
 9608|     52|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9608:17): [True: 0, False: 52]
  ------------------
 9609|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9610|      0|            }
 9611|     52|            return OPJ_TRUE;
  ------------------
  |  |  117|     52|#define OPJ_TRUE 1
  ------------------
 9612|     52|        }
 9613|       |
 9614|       |        /* Read 2 bytes from buffer as the new marker ID */
 9615|  3.31k|        opj_read_bytes(l_header_data, &l_current_marker, 2);
  ------------------
  |  |   65|  3.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9616|       |
 9617|  3.31k|        if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|  3.31k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9617:13): [True: 350, False: 2.96k]
  ------------------
 9618|       |            /* assume all is OK */
 9619|    350|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9619:17): [True: 0, False: 350]
  ------------------
 9620|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9621|      0|            }
 9622|    350|            return OPJ_TRUE;
  ------------------
  |  |  117|    350|#define OPJ_TRUE 1
  ------------------
 9623|    350|        }
 9624|       |
 9625|       |        /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 9626|  2.96k|        if (opj_stream_read_data(p_stream, l_header_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (9626:13): [True: 2, False: 2.96k]
  ------------------
 9627|      2|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9628|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 9629|      2|        }
 9630|       |
 9631|       |        /* Read 2 bytes from the buffer as the marker size */
 9632|  2.96k|        opj_read_bytes(l_header_data, &l_marker_size, 2);
  ------------------
  |  |   65|  2.96k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9633|       |
 9634|       |        /* Check marker size for SOT Marker */
 9635|  2.96k|        if (l_marker_size != 10) {
  ------------------
  |  Branch (9635:13): [True: 1, False: 2.96k]
  ------------------
 9636|      1|            opj_event_msg(p_manager, EVT_ERROR, "Inconsistent marker size\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9637|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9638|      1|        }
 9639|  2.96k|        l_marker_size -= 2;
 9640|       |
 9641|  2.96k|        if (opj_stream_read_data(p_stream, l_header_data, l_marker_size,
  ------------------
  |  Branch (9641:13): [True: 1, False: 2.96k]
  ------------------
 9642|  2.96k|                                 p_manager) != l_marker_size) {
 9643|      1|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9644|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9645|      1|        }
 9646|       |
 9647|  2.96k|        if (! opj_j2k_get_sot_values(l_header_data, l_marker_size, &l_tile_no,
  ------------------
  |  Branch (9647:13): [True: 0, False: 2.96k]
  ------------------
 9648|  2.96k|                                     &l_tot_len, &l_current_part, &l_num_parts, p_manager)) {
 9649|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9650|      0|        }
 9651|       |
 9652|  2.96k|        if (l_tile_no == tile_no) {
  ------------------
  |  Branch (9652:13): [True: 27, False: 2.93k]
  ------------------
 9653|       |            /* we found what we were looking for */
 9654|     27|            break;
 9655|     27|        }
 9656|       |
 9657|  2.93k|        if (l_tot_len < 14U) {
  ------------------
  |  Branch (9657:13): [True: 14, False: 2.91k]
  ------------------
 9658|       |            /* last SOT until EOC or invalid Psot value */
 9659|       |            /* assume all is OK */
 9660|     14|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9660:17): [True: 0, False: 14]
  ------------------
 9661|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9662|      0|            }
 9663|     14|            return OPJ_TRUE;
  ------------------
  |  |  117|     14|#define OPJ_TRUE 1
  ------------------
 9664|     14|        }
 9665|  2.91k|        l_tot_len -= 12U;
 9666|       |        /* look for next SOT marker */
 9667|  2.91k|        if (opj_stream_skip(p_stream, (OPJ_OFF_T)(l_tot_len),
  ------------------
  |  Branch (9667:13): [True: 227, False: 2.69k]
  ------------------
 9668|  2.91k|                            p_manager) != (OPJ_OFF_T)(l_tot_len)) {
 9669|       |            /* assume all is OK */
 9670|    227|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9670:17): [True: 0, False: 227]
  ------------------
 9671|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9672|      0|            }
 9673|    227|            return OPJ_TRUE;
  ------------------
  |  |  117|    227|#define OPJ_TRUE 1
  ------------------
 9674|    227|        }
 9675|  2.91k|    }
 9676|       |
 9677|       |    /* check for correction */
 9678|     27|    if (l_current_part == l_num_parts) {
  ------------------
  |  Branch (9678:9): [True: 18, False: 9]
  ------------------
 9679|     18|        *p_correction_needed = OPJ_TRUE;
  ------------------
  |  |  117|     18|#define OPJ_TRUE 1
  ------------------
 9680|     18|    }
 9681|       |
 9682|     27|    if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9682:9): [True: 0, False: 27]
  ------------------
 9683|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9684|      0|    }
 9685|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 9686|     27|}
j2k.c:opj_j2k_merge_ppt:
 4218|  7.39k|{
 4219|  7.39k|    OPJ_UINT32 i, l_ppt_data_size;
 4220|       |    /* preconditions */
 4221|  7.39k|    assert(p_tcp != 00);
 4222|  7.39k|    assert(p_manager != 00);
 4223|       |
 4224|  7.39k|    if (p_tcp->ppt_buffer != NULL) {
  ------------------
  |  Branch (4224:9): [True: 0, False: 7.39k]
  ------------------
 4225|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4226|      0|                      "opj_j2k_merge_ppt() has already been called\n");
 4227|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4228|      0|    }
 4229|       |
 4230|  7.39k|    if (p_tcp->ppt == 0U) {
  ------------------
  |  Branch (4230:9): [True: 7.36k, False: 30]
  ------------------
 4231|  7.36k|        return OPJ_TRUE;
  ------------------
  |  |  117|  7.36k|#define OPJ_TRUE 1
  ------------------
 4232|  7.36k|    }
 4233|       |
 4234|     30|    l_ppt_data_size = 0U;
 4235|    945|    for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (4235:18): [True: 915, False: 30]
  ------------------
 4236|    915|        l_ppt_data_size +=
 4237|    915|            p_tcp->ppt_markers[i].m_data_size; /* can't overflow, max 256 markers of max 65536 bytes */
 4238|    915|    }
 4239|       |
 4240|     30|    p_tcp->ppt_buffer = (OPJ_BYTE *) opj_malloc(l_ppt_data_size);
 4241|     30|    if (p_tcp->ppt_buffer == 00) {
  ------------------
  |  Branch (4241:9): [True: 0, False: 30]
  ------------------
 4242|      0|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4243|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4244|      0|    }
 4245|     30|    p_tcp->ppt_len = l_ppt_data_size;
 4246|     30|    l_ppt_data_size = 0U;
 4247|    945|    for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (4247:18): [True: 915, False: 30]
  ------------------
 4248|    915|        if (p_tcp->ppt_markers[i].m_data !=
  ------------------
  |  Branch (4248:13): [True: 30, False: 885]
  ------------------
 4249|    915|                NULL) { /* standard doesn't seem to require contiguous Zppt */
 4250|     30|            memcpy(p_tcp->ppt_buffer + l_ppt_data_size, p_tcp->ppt_markers[i].m_data,
 4251|     30|                   p_tcp->ppt_markers[i].m_data_size);
 4252|     30|            l_ppt_data_size +=
 4253|     30|                p_tcp->ppt_markers[i].m_data_size; /* can't overflow, max 256 markers of max 65536 bytes */
 4254|       |
 4255|     30|            opj_free(p_tcp->ppt_markers[i].m_data);
 4256|     30|            p_tcp->ppt_markers[i].m_data = NULL;
 4257|     30|            p_tcp->ppt_markers[i].m_data_size = 0U;
 4258|     30|        }
 4259|    915|    }
 4260|       |
 4261|     30|    p_tcp->ppt_markers_count = 0U;
 4262|     30|    opj_free(p_tcp->ppt_markers);
 4263|     30|    p_tcp->ppt_markers = NULL;
 4264|       |
 4265|     30|    p_tcp->ppt_data = p_tcp->ppt_buffer;
 4266|     30|    p_tcp->ppt_data_size = p_tcp->ppt_len;
 4267|     30|    return OPJ_TRUE;
  ------------------
  |  |  117|     30|#define OPJ_TRUE 1
  ------------------
 4268|     30|}
j2k.c:opj_j2k_tcp_data_destroy:
 9529|  19.1M|{
 9530|  19.1M|    if (p_tcp->m_data) {
  ------------------
  |  Branch (9530:9): [True: 7.55k, False: 19.1M]
  ------------------
 9531|  7.55k|        opj_free(p_tcp->m_data);
 9532|  7.55k|        p_tcp->m_data = NULL;
 9533|  7.55k|        p_tcp->m_data_size = 0;
 9534|  7.55k|    }
 9535|  19.1M|}
j2k.c:opj_j2k_update_image_dimensions:
10408|  7.44k|{
10409|  7.44k|    OPJ_UINT32 it_comp;
10410|  7.44k|    OPJ_INT32 l_comp_x1, l_comp_y1;
10411|  7.44k|    opj_image_comp_t* l_img_comp = NULL;
10412|       |
10413|  7.44k|    l_img_comp = p_image->comps;
10414|  30.4k|    for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (10414:23): [True: 22.9k, False: 7.44k]
  ------------------
10415|  22.9k|        OPJ_INT32 l_h, l_w;
10416|  22.9k|        if (p_image->x0 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10416:13): [True: 0, False: 22.9k]
  ------------------
10417|  22.9k|                p_image->y0 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10417:17): [True: 0, False: 22.9k]
  ------------------
10418|  22.9k|                p_image->x1 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10418:17): [True: 0, False: 22.9k]
  ------------------
10419|  22.9k|                p_image->y1 > (OPJ_UINT32)INT_MAX) {
  ------------------
  |  Branch (10419:17): [True: 0, False: 22.9k]
  ------------------
10420|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10421|      0|                          "Image coordinates above INT_MAX are not supported\n");
10422|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10423|      0|        }
10424|       |
10425|  22.9k|        l_img_comp->x0 = opj_uint_ceildiv(p_image->x0, l_img_comp->dx);
10426|  22.9k|        l_img_comp->y0 = opj_uint_ceildiv(p_image->y0, l_img_comp->dy);
10427|  22.9k|        l_comp_x1 = opj_int_ceildiv((OPJ_INT32)p_image->x1, (OPJ_INT32)l_img_comp->dx);
10428|  22.9k|        l_comp_y1 = opj_int_ceildiv((OPJ_INT32)p_image->y1, (OPJ_INT32)l_img_comp->dy);
10429|       |
10430|  22.9k|        l_w = opj_int_ceildivpow2(l_comp_x1, (OPJ_INT32)l_img_comp->factor)
10431|  22.9k|              - opj_int_ceildivpow2((OPJ_INT32)l_img_comp->x0, (OPJ_INT32)l_img_comp->factor);
10432|  22.9k|        if (l_w < 0) {
  ------------------
  |  Branch (10432:13): [True: 0, False: 22.9k]
  ------------------
10433|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10434|      0|                          "Size x of the decoded component image is incorrect (comp[%d].w=%d).\n",
10435|      0|                          it_comp, l_w);
10436|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10437|      0|        }
10438|  22.9k|        l_img_comp->w = (OPJ_UINT32)l_w;
10439|       |
10440|  22.9k|        l_h = opj_int_ceildivpow2(l_comp_y1, (OPJ_INT32)l_img_comp->factor)
10441|  22.9k|              - opj_int_ceildivpow2((OPJ_INT32)l_img_comp->y0, (OPJ_INT32)l_img_comp->factor);
10442|  22.9k|        if (l_h < 0) {
  ------------------
  |  Branch (10442:13): [True: 0, False: 22.9k]
  ------------------
10443|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10444|      0|                          "Size y of the decoded component image is incorrect (comp[%d].h=%d).\n",
10445|      0|                          it_comp, l_h);
10446|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10447|      0|        }
10448|  22.9k|        l_img_comp->h = (OPJ_UINT32)l_h;
10449|       |
10450|  22.9k|        l_img_comp++;
10451|  22.9k|    }
10452|       |
10453|  7.44k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.44k|#define OPJ_TRUE 1
  ------------------
10454|  7.44k|}
j2k.c:opj_j2k_create_cstr_index:
10746|  8.85k|{
10747|  8.85k|    opj_codestream_index_t* cstr_index = (opj_codestream_index_t*)
10748|  8.85k|                                         opj_calloc(1, sizeof(opj_codestream_index_t));
10749|  8.85k|    if (!cstr_index) {
  ------------------
  |  Branch (10749:9): [True: 0, False: 8.85k]
  ------------------
10750|      0|        return NULL;
10751|      0|    }
10752|       |
10753|  8.85k|    cstr_index->maxmarknum = 100;
10754|  8.85k|    cstr_index->marknum = 0;
10755|  8.85k|    cstr_index->marker = (opj_marker_info_t*)
10756|  8.85k|                         opj_calloc(cstr_index->maxmarknum, sizeof(opj_marker_info_t));
10757|  8.85k|    if (!cstr_index-> marker) {
  ------------------
  |  Branch (10757:9): [True: 0, False: 8.85k]
  ------------------
10758|      0|        opj_free(cstr_index);
10759|      0|        return NULL;
10760|      0|    }
10761|       |
10762|  8.85k|    cstr_index->tile_index = NULL;
10763|       |
10764|  8.85k|    return cstr_index;
10765|  8.85k|}
j2k.c:opj_j2k_setup_decoding:
12129|  7.44k|{
12130|       |    /* preconditions*/
12131|  7.44k|    assert(p_j2k != 00);
12132|  7.44k|    assert(p_manager != 00);
12133|       |
12134|  7.44k|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (12134:9): [True: 0, False: 7.44k]
  ------------------
12135|  7.44k|                                           (opj_procedure)opj_j2k_decode_tiles, p_manager)) {
12136|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12137|      0|    }
12138|       |    /* DEVELOPER CORNER, add your custom procedures */
12139|       |
12140|  7.44k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.44k|#define OPJ_TRUE 1
  ------------------
12141|  7.44k|}
j2k.c:opj_j2k_decode_tiles:
11930|  7.44k|{
11931|  7.44k|    OPJ_BOOL l_go_on = OPJ_TRUE;
  ------------------
  |  |  117|  7.44k|#define OPJ_TRUE 1
  ------------------
11932|  7.44k|    OPJ_UINT32 l_current_tile_no;
11933|  7.44k|    OPJ_INT32 l_tile_x0, l_tile_y0, l_tile_x1, l_tile_y1;
11934|  7.44k|    OPJ_UINT32 l_nb_comps;
11935|  7.44k|    OPJ_UINT32 nr_tiles = 0;
11936|  7.44k|    OPJ_OFF_T end_pos = 0;
11937|       |
11938|       |    /* Particular case for whole single tile decoding */
11939|       |    /* We can avoid allocating intermediate tile buffers */
11940|  7.44k|    if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (11940:9): [True: 6.38k, False: 1.05k]
  |  Branch (11940:32): [True: 3.65k, False: 2.72k]
  ------------------
11941|  7.44k|            p_j2k->m_cp.tx0 == 0 && p_j2k->m_cp.ty0 == 0 &&
  ------------------
  |  Branch (11941:13): [True: 3.55k, False: 106]
  |  Branch (11941:37): [True: 3.31k, False: 241]
  ------------------
11942|  7.44k|            p_j2k->m_output_image->x0 == 0 &&
  ------------------
  |  Branch (11942:13): [True: 2.00k, False: 1.30k]
  ------------------
11943|  7.44k|            p_j2k->m_output_image->y0 == 0 &&
  ------------------
  |  Branch (11943:13): [True: 847, False: 1.15k]
  ------------------
11944|  7.44k|            p_j2k->m_output_image->x1 == p_j2k->m_cp.tdx &&
  ------------------
  |  Branch (11944:13): [True: 38, False: 809]
  ------------------
11945|  7.44k|            p_j2k->m_output_image->y1 == p_j2k->m_cp.tdy) {
  ------------------
  |  Branch (11945:13): [True: 8, False: 30]
  ------------------
11946|      8|        OPJ_UINT32 i;
11947|      8|        if (! opj_j2k_read_tile_header(p_j2k,
  ------------------
  |  Branch (11947:13): [True: 1, False: 7]
  ------------------
11948|      8|                                       &l_current_tile_no,
11949|      8|                                       NULL,
11950|      8|                                       &l_tile_x0, &l_tile_y0,
11951|      8|                                       &l_tile_x1, &l_tile_y1,
11952|      8|                                       &l_nb_comps,
11953|      8|                                       &l_go_on,
11954|      8|                                       p_stream,
11955|      8|                                       p_manager)) {
11956|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
11957|      1|        }
11958|       |
11959|      7|        if (!l_go_on ||
  ------------------
  |  Branch (11959:13): [True: 2, False: 5]
  ------------------
11960|      7|                ! opj_j2k_decode_tile(p_j2k, l_current_tile_no, NULL, 0,
  ------------------
  |  Branch (11960:17): [True: 3, False: 2]
  ------------------
11961|      5|                                      p_stream, p_manager)) {
11962|      5|            opj_event_msg(p_manager, EVT_ERROR, "Failed to decode tile 1/1\n");
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11963|      5|            return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
11964|      5|        }
11965|       |
11966|       |        /* Transfer TCD data to output image data */
11967|    260|        for (i = 0; i < p_j2k->m_output_image->numcomps; i++) {
  ------------------
  |  Branch (11967:21): [True: 258, False: 2]
  ------------------
11968|    258|            opj_image_data_free(p_j2k->m_output_image->comps[i].data);
11969|    258|            p_j2k->m_output_image->comps[i].data =
11970|    258|                p_j2k->m_tcd->tcd_image->tiles->comps[i].data;
11971|    258|            p_j2k->m_output_image->comps[i].resno_decoded =
11972|    258|                p_j2k->m_tcd->image->comps[i].resno_decoded;
11973|    258|            p_j2k->m_tcd->tcd_image->tiles->comps[i].data = NULL;
11974|    258|        }
11975|       |
11976|      2|        return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
11977|      7|    }
11978|       |
11979|  7.43k|    p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts = 0;
11980|  7.43k|    p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts = 0;
11981|  7.43k|    opj_free(p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset);
11982|  7.43k|    p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset = NULL;
11983|       |
11984|       |    /* If the area to decode only intersects a subset of tiles, and we have
11985|       |     * valid TLM information, then use it to plan the tilepart offsets to
11986|       |     * seek to.
11987|       |     */
11988|  7.43k|    if (!(p_j2k->m_specific_param.m_decoder.m_start_tile_x == 0 &&
  ------------------
  |  Branch (11988:11): [True: 7.43k, False: 0]
  ------------------
11989|  7.43k|            p_j2k->m_specific_param.m_decoder.m_start_tile_y == 0 &&
  ------------------
  |  Branch (11989:13): [True: 7.43k, False: 0]
  ------------------
11990|  7.43k|            p_j2k->m_specific_param.m_decoder.m_end_tile_x == p_j2k->m_cp.tw &&
  ------------------
  |  Branch (11990:13): [True: 6.87k, False: 563]
  ------------------
11991|  7.43k|            p_j2k->m_specific_param.m_decoder.m_end_tile_y == p_j2k->m_cp.th) &&
  ------------------
  |  Branch (11991:13): [True: 5.20k, False: 1.66k]
  ------------------
11992|  7.43k|            !p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid &&
  ------------------
  |  Branch (11992:13): [True: 0, False: 2.23k]
  ------------------
11993|  7.43k|            opj_stream_has_seek(p_stream)) {
  ------------------
  |  Branch (11993:13): [True: 0, False: 0]
  ------------------
11994|      0|        OPJ_UINT32 m_num_intersecting_tile_parts = 0;
11995|       |
11996|      0|        OPJ_UINT32 j;
11997|      0|        for (j = 0; j < p_j2k->m_cp.tw * p_j2k->m_cp.th; ++j) {
  ------------------
  |  Branch (11997:21): [True: 0, False: 0]
  ------------------
11998|      0|            if (p_j2k->cstr_index->tile_index[j].nb_tps > 0 &&
  ------------------
  |  Branch (11998:17): [True: 0, False: 0]
  ------------------
11999|      0|                    p_j2k->cstr_index->tile_index[j].tp_index[
  ------------------
  |  Branch (11999:21): [True: 0, False: 0]
  ------------------
12000|      0|                        p_j2k->cstr_index->tile_index[j].nb_tps - 1].end_pos > end_pos) {
12001|      0|                end_pos = p_j2k->cstr_index->tile_index[j].tp_index[
12002|      0|                              p_j2k->cstr_index->tile_index[j].nb_tps - 1].end_pos;
12003|      0|            }
12004|      0|        }
12005|       |
12006|      0|        for (j = p_j2k->m_specific_param.m_decoder.m_start_tile_y;
12007|      0|                j < p_j2k->m_specific_param.m_decoder.m_end_tile_y; ++j) {
  ------------------
  |  Branch (12007:17): [True: 0, False: 0]
  ------------------
12008|      0|            OPJ_UINT32 i;
12009|      0|            for (i = p_j2k->m_specific_param.m_decoder.m_start_tile_x;
12010|      0|                    i < p_j2k->m_specific_param.m_decoder.m_end_tile_x; ++i) {
  ------------------
  |  Branch (12010:21): [True: 0, False: 0]
  ------------------
12011|      0|                const OPJ_UINT32 tile_number = j * p_j2k->m_cp.tw + i;
12012|      0|                m_num_intersecting_tile_parts +=
12013|      0|                    p_j2k->cstr_index->tile_index[tile_number].nb_tps;
12014|      0|            }
12015|      0|        }
12016|       |
12017|      0|        p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset =
12018|      0|            (OPJ_OFF_T*)
12019|      0|            opj_malloc(m_num_intersecting_tile_parts * sizeof(OPJ_OFF_T));
12020|      0|        if (m_num_intersecting_tile_parts > 0 &&
  ------------------
  |  Branch (12020:13): [True: 0, False: 0]
  ------------------
12021|      0|                p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset) {
  ------------------
  |  Branch (12021:17): [True: 0, False: 0]
  ------------------
12022|      0|            OPJ_UINT32 idx = 0;
12023|      0|            for (j = p_j2k->m_specific_param.m_decoder.m_start_tile_y;
12024|      0|                    j < p_j2k->m_specific_param.m_decoder.m_end_tile_y; ++j) {
  ------------------
  |  Branch (12024:21): [True: 0, False: 0]
  ------------------
12025|      0|                OPJ_UINT32 i;
12026|      0|                for (i = p_j2k->m_specific_param.m_decoder.m_start_tile_x;
12027|      0|                        i < p_j2k->m_specific_param.m_decoder.m_end_tile_x; ++i) {
  ------------------
  |  Branch (12027:25): [True: 0, False: 0]
  ------------------
12028|      0|                    const OPJ_UINT32 tile_number = j * p_j2k->m_cp.tw + i;
12029|      0|                    OPJ_UINT32 k;
12030|      0|                    for (k = 0; k < p_j2k->cstr_index->tile_index[tile_number].nb_tps; ++k) {
  ------------------
  |  Branch (12030:33): [True: 0, False: 0]
  ------------------
12031|      0|                        const OPJ_OFF_T next_tp_sot_pos =
12032|      0|                            p_j2k->cstr_index->tile_index[tile_number].tp_index[k].start_pos;
12033|      0|                        p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset[idx] =
12034|      0|                            next_tp_sot_pos;
12035|      0|                        ++idx;
12036|      0|                    }
12037|      0|                }
12038|      0|            }
12039|       |
12040|      0|            p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts = idx;
12041|       |
12042|       |            /* Sort by increasing offset */
12043|      0|            qsort(p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset,
12044|      0|                  p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts,
12045|      0|                  sizeof(OPJ_OFF_T),
12046|      0|                  CompareOffT);
12047|      0|        }
12048|      0|    }
12049|       |
12050|  7.90k|    for (;;) {
12051|  7.90k|        if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (12051:13): [True: 6.61k, False: 1.29k]
  |  Branch (12051:36): [True: 3.65k, False: 2.96k]
  ------------------
12052|  7.90k|                p_j2k->m_cp.tcps[0].m_data != NULL) {
  ------------------
  |  Branch (12052:17): [True: 0, False: 3.65k]
  ------------------
12053|      0|            l_current_tile_no = 0;
12054|      0|            p_j2k->m_current_tile_number = 0;
12055|      0|            p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_DATA;
12056|  7.90k|        } else {
12057|  7.90k|            if (! opj_j2k_read_tile_header(p_j2k,
  ------------------
  |  Branch (12057:17): [True: 498, False: 7.40k]
  ------------------
12058|  7.90k|                                           &l_current_tile_no,
12059|  7.90k|                                           NULL,
12060|  7.90k|                                           &l_tile_x0, &l_tile_y0,
12061|  7.90k|                                           &l_tile_x1, &l_tile_y1,
12062|  7.90k|                                           &l_nb_comps,
12063|  7.90k|                                           &l_go_on,
12064|  7.90k|                                           p_stream,
12065|  7.90k|                                           p_manager)) {
12066|    498|                return OPJ_FALSE;
  ------------------
  |  |  118|    498|#define OPJ_FALSE 0
  ------------------
12067|    498|            }
12068|       |
12069|  7.40k|            if (! l_go_on) {
  ------------------
  |  Branch (12069:17): [True: 52, False: 7.35k]
  ------------------
12070|     52|                break;
12071|     52|            }
12072|  7.40k|        }
12073|       |
12074|  7.35k|        if (! opj_j2k_decode_tile(p_j2k, l_current_tile_no, NULL, 0,
  ------------------
  |  Branch (12074:13): [True: 5.26k, False: 2.08k]
  ------------------
12075|  7.35k|                                  p_stream, p_manager)) {
12076|  5.26k|            opj_event_msg(p_manager, EVT_ERROR, "Failed to decode tile %d/%d\n",
  ------------------
  |  |   66|  5.26k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
12077|  5.26k|                          l_current_tile_no + 1, p_j2k->m_cp.th * p_j2k->m_cp.tw);
12078|  5.26k|            return OPJ_FALSE;
  ------------------
  |  |  118|  5.26k|#define OPJ_FALSE 0
  ------------------
12079|  5.26k|        }
12080|       |
12081|  2.08k|        opj_event_msg(p_manager, EVT_INFO, "Tile %d/%d has been decoded.\n",
  ------------------
  |  |   68|  2.08k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
12082|  2.08k|                      l_current_tile_no + 1, p_j2k->m_cp.th * p_j2k->m_cp.tw);
12083|       |
12084|  2.08k|        if (! opj_j2k_update_image_data(p_j2k->m_tcd,
  ------------------
  |  Branch (12084:13): [True: 25, False: 2.06k]
  ------------------
12085|  2.08k|                                        p_j2k->m_output_image)) {
12086|     25|            return OPJ_FALSE;
  ------------------
  |  |  118|     25|#define OPJ_FALSE 0
  ------------------
12087|     25|        }
12088|       |
12089|  2.06k|        if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (12089:13): [True: 1.68k, False: 375]
  |  Branch (12089:36): [True: 1.23k, False: 457]
  ------------------
12090|  2.06k|                !(p_j2k->m_output_image->x0 == p_j2k->m_private_image->x0 &&
  ------------------
  |  Branch (12090:19): [True: 1.23k, False: 0]
  ------------------
12091|  1.23k|                  p_j2k->m_output_image->y0 == p_j2k->m_private_image->y0 &&
  ------------------
  |  Branch (12091:19): [True: 1.23k, False: 0]
  ------------------
12092|  1.23k|                  p_j2k->m_output_image->x1 == p_j2k->m_private_image->x1 &&
  ------------------
  |  Branch (12092:19): [True: 1.08k, False: 145]
  ------------------
12093|  1.23k|                  p_j2k->m_output_image->y1 == p_j2k->m_private_image->y1)) {
  ------------------
  |  Branch (12093:19): [True: 1.02k, False: 66]
  ------------------
12094|       |            /* Keep current tcp data */
12095|  1.85k|        } else {
12096|  1.85k|            opj_j2k_tcp_data_destroy(&p_j2k->m_cp.tcps[l_current_tile_no]);
12097|  1.85k|        }
12098|       |
12099|  2.06k|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|  2.06k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
12100|  2.06k|                      "Image data has been updated with tile %d.\n\n", l_current_tile_no + 1);
12101|       |
12102|  2.06k|        if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (12102:13): [True: 1.58k, False: 482]
  ------------------
12103|  2.06k|                && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (12103:20): [True: 1.58k, False: 0]
  ------------------
12104|  1.58k|            break;
12105|  1.58k|        }
12106|    482|        if (++nr_tiles ==  p_j2k->m_cp.th * p_j2k->m_cp.tw) {
  ------------------
  |  Branch (12106:13): [True: 11, False: 471]
  ------------------
12107|     11|            break;
12108|     11|        }
12109|    471|        if (p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts > 0 &&
  ------------------
  |  Branch (12109:13): [True: 0, False: 471]
  ------------------
12110|    471|                p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts ==
  ------------------
  |  Branch (12110:17): [True: 0, False: 0]
  ------------------
12111|      0|                p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts) {
12112|      0|            opj_stream_seek(p_stream, end_pos + 2, p_manager);
12113|      0|            break;
12114|      0|        }
12115|    471|    }
12116|       |
12117|  1.64k|    if (! opj_j2k_are_all_used_components_decoded(p_j2k, p_manager)) {
  ------------------
  |  Branch (12117:9): [True: 83, False: 1.56k]
  ------------------
12118|     83|        return OPJ_FALSE;
  ------------------
  |  |  118|     83|#define OPJ_FALSE 0
  ------------------
12119|     83|    }
12120|       |
12121|  1.56k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.56k|#define OPJ_TRUE 1
  ------------------
12122|  1.64k|}
j2k.c:opj_j2k_update_image_data:
10191|  2.08k|{
10192|  2.08k|    OPJ_UINT32 i, j;
10193|  2.08k|    OPJ_UINT32 l_width_src, l_height_src;
10194|  2.08k|    OPJ_UINT32 l_width_dest, l_height_dest;
10195|  2.08k|    OPJ_INT32 l_offset_x0_src, l_offset_y0_src, l_offset_x1_src, l_offset_y1_src;
10196|  2.08k|    OPJ_SIZE_T l_start_offset_src;
10197|  2.08k|    OPJ_UINT32 l_start_x_dest, l_start_y_dest;
10198|  2.08k|    OPJ_UINT32 l_x0_dest, l_y0_dest, l_x1_dest, l_y1_dest;
10199|  2.08k|    OPJ_SIZE_T l_start_offset_dest;
10200|       |
10201|  2.08k|    opj_image_comp_t * l_img_comp_src = 00;
10202|  2.08k|    opj_image_comp_t * l_img_comp_dest = 00;
10203|       |
10204|  2.08k|    opj_tcd_tilecomp_t * l_tilec = 00;
10205|  2.08k|    opj_image_t * l_image_src = 00;
10206|  2.08k|    OPJ_INT32 * l_dest_ptr;
10207|       |
10208|  2.08k|    l_tilec = p_tcd->tcd_image->tiles->comps;
10209|  2.08k|    l_image_src = p_tcd->image;
10210|  2.08k|    l_img_comp_src = l_image_src->comps;
10211|       |
10212|  2.08k|    l_img_comp_dest = p_output_image->comps;
10213|       |
10214|  12.7k|    for (i = 0; i < l_image_src->numcomps;
  ------------------
  |  Branch (10214:17): [True: 10.6k, False: 2.06k]
  ------------------
10215|  10.6k|            i++, ++l_img_comp_dest, ++l_img_comp_src,  ++l_tilec) {
10216|  10.6k|        OPJ_INT32 res_x0, res_x1, res_y0, res_y1;
10217|  10.6k|        OPJ_UINT32 src_data_stride;
10218|  10.6k|        const OPJ_INT32* p_src_data;
10219|       |
10220|       |        /* Copy info from decoded comp image to output image */
10221|  10.6k|        l_img_comp_dest->resno_decoded = l_img_comp_src->resno_decoded;
10222|       |
10223|  10.6k|        if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (10223:13): [True: 6.63k, False: 4.04k]
  ------------------
10224|  6.63k|            opj_tcd_resolution_t* l_res = l_tilec->resolutions +
10225|  6.63k|                                          l_img_comp_src->resno_decoded;
10226|  6.63k|            res_x0 = l_res->x0;
10227|  6.63k|            res_y0 = l_res->y0;
10228|  6.63k|            res_x1 = l_res->x1;
10229|  6.63k|            res_y1 = l_res->y1;
10230|  6.63k|            src_data_stride = (OPJ_UINT32)(
10231|  6.63k|                                  l_tilec->resolutions[l_tilec->minimum_num_resolutions - 1].x1 -
10232|  6.63k|                                  l_tilec->resolutions[l_tilec->minimum_num_resolutions - 1].x0);
10233|  6.63k|            p_src_data = l_tilec->data;
10234|  6.63k|        } else {
10235|  4.04k|            opj_tcd_resolution_t* l_res = l_tilec->resolutions +
10236|  4.04k|                                          l_img_comp_src->resno_decoded;
10237|  4.04k|            res_x0 = (OPJ_INT32)l_res->win_x0;
10238|  4.04k|            res_y0 = (OPJ_INT32)l_res->win_y0;
10239|  4.04k|            res_x1 = (OPJ_INT32)l_res->win_x1;
10240|  4.04k|            res_y1 = (OPJ_INT32)l_res->win_y1;
10241|  4.04k|            src_data_stride = l_res->win_x1 - l_res->win_x0;
10242|  4.04k|            p_src_data = l_tilec->data_win;
10243|  4.04k|        }
10244|       |
10245|  10.6k|        if (p_src_data == NULL) {
  ------------------
  |  Branch (10245:13): [True: 2.19k, False: 8.48k]
  ------------------
10246|       |            /* Happens for partial component decoding */
10247|  2.19k|            continue;
10248|  2.19k|        }
10249|       |
10250|  8.48k|        l_width_src = (OPJ_UINT32)(res_x1 - res_x0);
10251|  8.48k|        l_height_src = (OPJ_UINT32)(res_y1 - res_y0);
10252|       |
10253|       |
10254|       |        /* Current tile component size*/
10255|       |        /*if (i == 0) {
10256|       |        fprintf(stdout, "SRC: l_res_x0=%d, l_res_x1=%d, l_res_y0=%d, l_res_y1=%d\n",
10257|       |                        res_x0, res_x1, res_y0, res_y1);
10258|       |        }*/
10259|       |
10260|       |
10261|       |        /* Border of the current output component*/
10262|  8.48k|        l_x0_dest = opj_uint_ceildivpow2(l_img_comp_dest->x0, l_img_comp_dest->factor);
10263|  8.48k|        l_y0_dest = opj_uint_ceildivpow2(l_img_comp_dest->y0, l_img_comp_dest->factor);
10264|  8.48k|        l_x1_dest = l_x0_dest +
10265|  8.48k|                    l_img_comp_dest->w; /* can't overflow given that image->x1 is uint32 */
10266|  8.48k|        l_y1_dest = l_y0_dest + l_img_comp_dest->h;
10267|       |
10268|       |        /*if (i == 0) {
10269|       |        fprintf(stdout, "DEST: l_x0_dest=%d, l_x1_dest=%d, l_y0_dest=%d, l_y1_dest=%d (%d)\n",
10270|       |                        l_x0_dest, l_x1_dest, l_y0_dest, l_y1_dest, l_img_comp_dest->factor );
10271|       |        }*/
10272|       |
10273|       |        /*-----*/
10274|       |        /* Compute the area (l_offset_x0_src, l_offset_y0_src, l_offset_x1_src, l_offset_y1_src)
10275|       |         * of the input buffer (decoded tile component) which will be move
10276|       |         * in the output buffer. Compute the area of the output buffer (l_start_x_dest,
10277|       |         * l_start_y_dest, l_width_dest, l_height_dest)  which will be modified
10278|       |         * by this input area.
10279|       |         * */
10280|  8.48k|        assert(res_x0 >= 0);
10281|  8.48k|        assert(res_x1 >= 0);
10282|  8.48k|        if (l_x0_dest < (OPJ_UINT32)res_x0) {
  ------------------
  |  Branch (10282:13): [True: 590, False: 7.89k]
  ------------------
10283|    590|            l_start_x_dest = (OPJ_UINT32)res_x0 - l_x0_dest;
10284|    590|            l_offset_x0_src = 0;
10285|       |
10286|    590|            if (l_x1_dest >= (OPJ_UINT32)res_x1) {
  ------------------
  |  Branch (10286:17): [True: 590, False: 0]
  ------------------
10287|    590|                l_width_dest = l_width_src;
10288|    590|                l_offset_x1_src = 0;
10289|    590|            } else {
10290|      0|                l_width_dest = l_x1_dest - (OPJ_UINT32)res_x0 ;
10291|      0|                l_offset_x1_src = (OPJ_INT32)(l_width_src - l_width_dest);
10292|      0|            }
10293|  7.89k|        } else {
10294|  7.89k|            l_start_x_dest = 0U;
10295|  7.89k|            l_offset_x0_src = (OPJ_INT32)l_x0_dest - res_x0;
10296|       |
10297|  7.89k|            if (l_x1_dest >= (OPJ_UINT32)res_x1) {
  ------------------
  |  Branch (10297:17): [True: 7.89k, False: 0]
  ------------------
10298|  7.89k|                l_width_dest = l_width_src - (OPJ_UINT32)l_offset_x0_src;
10299|  7.89k|                l_offset_x1_src = 0;
10300|  7.89k|            } else {
10301|      0|                l_width_dest = l_img_comp_dest->w ;
10302|      0|                l_offset_x1_src = res_x1 - (OPJ_INT32)l_x1_dest;
10303|      0|            }
10304|  7.89k|        }
10305|       |
10306|  8.48k|        if (l_y0_dest < (OPJ_UINT32)res_y0) {
  ------------------
  |  Branch (10306:13): [True: 1.50k, False: 6.98k]
  ------------------
10307|  1.50k|            l_start_y_dest = (OPJ_UINT32)res_y0 - l_y0_dest;
10308|  1.50k|            l_offset_y0_src = 0;
10309|       |
10310|  1.50k|            if (l_y1_dest >= (OPJ_UINT32)res_y1) {
  ------------------
  |  Branch (10310:17): [True: 1.50k, False: 0]
  ------------------
10311|  1.50k|                l_height_dest = l_height_src;
10312|  1.50k|                l_offset_y1_src = 0;
10313|  1.50k|            } else {
10314|      0|                l_height_dest = l_y1_dest - (OPJ_UINT32)res_y0 ;
10315|      0|                l_offset_y1_src = (OPJ_INT32)(l_height_src - l_height_dest);
10316|      0|            }
10317|  6.98k|        } else {
10318|  6.98k|            l_start_y_dest = 0U;
10319|  6.98k|            l_offset_y0_src = (OPJ_INT32)l_y0_dest - res_y0;
10320|       |
10321|  6.98k|            if (l_y1_dest >= (OPJ_UINT32)res_y1) {
  ------------------
  |  Branch (10321:17): [True: 6.98k, False: 0]
  ------------------
10322|  6.98k|                l_height_dest = l_height_src - (OPJ_UINT32)l_offset_y0_src;
10323|  6.98k|                l_offset_y1_src = 0;
10324|  6.98k|            } else {
10325|      0|                l_height_dest = l_img_comp_dest->h ;
10326|      0|                l_offset_y1_src = res_y1 - (OPJ_INT32)l_y1_dest;
10327|      0|            }
10328|  6.98k|        }
10329|       |
10330|  8.48k|        if ((l_offset_x0_src < 0) || (l_offset_y0_src < 0) || (l_offset_x1_src < 0) ||
  ------------------
  |  Branch (10330:13): [True: 0, False: 8.48k]
  |  Branch (10330:38): [True: 0, False: 8.48k]
  |  Branch (10330:63): [True: 0, False: 8.48k]
  ------------------
10331|  8.48k|                (l_offset_y1_src < 0)) {
  ------------------
  |  Branch (10331:17): [True: 0, False: 8.48k]
  ------------------
10332|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10333|      0|        }
10334|       |        /* testcase 2977.pdf.asan.67.2198 */
10335|  8.48k|        if ((OPJ_INT32)l_width_dest < 0 || (OPJ_INT32)l_height_dest < 0) {
  ------------------
  |  Branch (10335:13): [True: 16, False: 8.47k]
  |  Branch (10335:44): [True: 9, False: 8.46k]
  ------------------
10336|     25|            return OPJ_FALSE;
  ------------------
  |  |  118|     25|#define OPJ_FALSE 0
  ------------------
10337|     25|        }
10338|       |        /*-----*/
10339|       |
10340|       |        /* Compute the input buffer offset */
10341|  8.46k|        l_start_offset_src = (OPJ_SIZE_T)l_offset_x0_src + (OPJ_SIZE_T)l_offset_y0_src
10342|  8.46k|                             * (OPJ_SIZE_T)src_data_stride;
10343|       |
10344|       |        /* Compute the output buffer offset */
10345|  8.46k|        l_start_offset_dest = (OPJ_SIZE_T)l_start_x_dest + (OPJ_SIZE_T)l_start_y_dest
10346|  8.46k|                              * (OPJ_SIZE_T)l_img_comp_dest->w;
10347|       |
10348|       |        /* Allocate output component buffer if necessary */
10349|  8.46k|        if (l_img_comp_dest->data == NULL &&
  ------------------
  |  Branch (10349:13): [True: 7.21k, False: 1.24k]
  ------------------
10350|  8.46k|                l_start_offset_src == 0 && l_start_offset_dest == 0 &&
  ------------------
  |  Branch (10350:17): [True: 7.12k, False: 93]
  |  Branch (10350:44): [True: 6.33k, False: 789]
  ------------------
10351|  8.46k|                src_data_stride == l_img_comp_dest->w &&
  ------------------
  |  Branch (10351:17): [True: 4.62k, False: 1.71k]
  ------------------
10352|  8.46k|                l_width_dest == l_img_comp_dest->w &&
  ------------------
  |  Branch (10352:17): [True: 4.61k, False: 6]
  ------------------
10353|  8.46k|                l_height_dest == l_img_comp_dest->h) {
  ------------------
  |  Branch (10353:17): [True: 3.66k, False: 949]
  ------------------
10354|       |            /* If the final image matches the tile buffer, then borrow it */
10355|       |            /* directly to save a copy */
10356|  3.66k|            if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (10356:17): [True: 1.80k, False: 1.85k]
  ------------------
10357|  1.80k|                l_img_comp_dest->data = l_tilec->data;
10358|  1.80k|                l_tilec->data = NULL;
10359|  1.85k|            } else {
10360|  1.85k|                l_img_comp_dest->data = l_tilec->data_win;
10361|  1.85k|                l_tilec->data_win = NULL;
10362|  1.85k|            }
10363|  3.66k|            continue;
10364|  4.79k|        } else if (l_img_comp_dest->data == NULL) {
  ------------------
  |  Branch (10364:20): [True: 3.55k, False: 1.24k]
  ------------------
10365|  3.55k|            OPJ_SIZE_T l_width = l_img_comp_dest->w;
10366|  3.55k|            OPJ_SIZE_T l_height = l_img_comp_dest->h;
10367|       |
10368|  3.55k|            if ((l_height == 0U) || (l_width > (SIZE_MAX / l_height)) ||
  ------------------
  |  Branch (10368:17): [True: 0, False: 3.55k]
  |  Branch (10368:37): [True: 0, False: 3.55k]
  ------------------
10369|  3.55k|                    l_width * l_height > SIZE_MAX / sizeof(OPJ_INT32)) {
  ------------------
  |  Branch (10369:21): [True: 0, False: 3.55k]
  ------------------
10370|       |                /* would overflow */
10371|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10372|      0|            }
10373|  3.55k|            l_img_comp_dest->data = (OPJ_INT32*) opj_image_data_alloc(l_width * l_height *
10374|  3.55k|                                    sizeof(OPJ_INT32));
10375|  3.55k|            if (! l_img_comp_dest->data) {
  ------------------
  |  Branch (10375:17): [True: 0, False: 3.55k]
  ------------------
10376|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10377|      0|            }
10378|       |
10379|  3.55k|            if (l_img_comp_dest->w != l_width_dest ||
  ------------------
  |  Branch (10379:17): [True: 2.50k, False: 1.04k]
  ------------------
10380|  3.55k|                    l_img_comp_dest->h != l_height_dest) {
  ------------------
  |  Branch (10380:21): [True: 1.04k, False: 0]
  ------------------
10381|  3.55k|                memset(l_img_comp_dest->data, 0,
10382|  3.55k|                       (OPJ_SIZE_T)l_img_comp_dest->w * l_img_comp_dest->h * sizeof(OPJ_INT32));
10383|  3.55k|            }
10384|  3.55k|        }
10385|       |
10386|       |        /* Move the output buffer to the first place where we will write*/
10387|  4.79k|        l_dest_ptr = l_img_comp_dest->data + l_start_offset_dest;
10388|       |
10389|  4.79k|        {
10390|  4.79k|            const OPJ_INT32 * l_src_ptr = p_src_data;
10391|  4.79k|            l_src_ptr += l_start_offset_src;
10392|       |
10393|   981k|            for (j = 0; j < l_height_dest; ++j) {
  ------------------
  |  Branch (10393:25): [True: 976k, False: 4.79k]
  ------------------
10394|   976k|                memcpy(l_dest_ptr, l_src_ptr, l_width_dest * sizeof(OPJ_INT32));
10395|   976k|                l_dest_ptr += l_img_comp_dest->w;
10396|   976k|                l_src_ptr += src_data_stride;
10397|   976k|            }
10398|  4.79k|        }
10399|       |
10400|       |
10401|  4.79k|    }
10402|       |
10403|  2.06k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.06k|#define OPJ_TRUE 1
  ------------------
10404|  2.08k|}
j2k.c:opj_j2k_are_all_used_components_decoded:
11881|  1.64k|{
11882|  1.64k|    OPJ_UINT32 compno;
11883|  1.64k|    OPJ_BOOL decoded_all_used_components = OPJ_TRUE;
  ------------------
  |  |  117|  1.64k|#define OPJ_TRUE 1
  ------------------
11884|       |
11885|  1.64k|    if (p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode) {
  ------------------
  |  Branch (11885:9): [True: 0, False: 1.64k]
  ------------------
11886|      0|        for (compno = 0;
11887|      0|                compno < p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode; compno++) {
  ------------------
  |  Branch (11887:17): [True: 0, False: 0]
  ------------------
11888|      0|            OPJ_UINT32 dec_compno =
11889|      0|                p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode[compno];
11890|      0|            if (p_j2k->m_output_image->comps[dec_compno].data == NULL) {
  ------------------
  |  Branch (11890:17): [True: 0, False: 0]
  ------------------
11891|      0|                opj_event_msg(p_manager, EVT_WARNING, "Failed to decode component %d\n",
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11892|      0|                              dec_compno);
11893|      0|                decoded_all_used_components = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11894|      0|            }
11895|      0|        }
11896|  1.64k|    } else {
11897|  8.73k|        for (compno = 0; compno < p_j2k->m_output_image->numcomps; compno++) {
  ------------------
  |  Branch (11897:26): [True: 7.09k, False: 1.64k]
  ------------------
11898|  7.09k|            if (p_j2k->m_output_image->comps[compno].data == NULL) {
  ------------------
  |  Branch (11898:17): [True: 1.19k, False: 5.89k]
  ------------------
11899|  1.19k|                opj_event_msg(p_manager, EVT_WARNING, "Failed to decode component %d\n",
  ------------------
  |  |   67|  1.19k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11900|  1.19k|                              compno);
11901|  1.19k|                decoded_all_used_components = OPJ_FALSE;
  ------------------
  |  |  118|  1.19k|#define OPJ_FALSE 0
  ------------------
11902|  1.19k|            }
11903|  7.09k|        }
11904|  1.64k|    }
11905|       |
11906|  1.64k|    if (decoded_all_used_components == OPJ_FALSE) {
  ------------------
  |  |  118|  1.64k|#define OPJ_FALSE 0
  ------------------
  |  Branch (11906:9): [True: 83, False: 1.56k]
  ------------------
11907|     83|        opj_event_msg(p_manager, EVT_ERROR, "Failed to decode all used components\n");
  ------------------
  |  |   66|     83|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11908|     83|        return OPJ_FALSE;
  ------------------
  |  |  118|     83|#define OPJ_FALSE 0
  ------------------
11909|     83|    }
11910|       |
11911|  1.56k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.56k|#define OPJ_TRUE 1
  ------------------
11912|  1.64k|}
j2k.c:opj_j2k_move_data_from_codec_to_output_image:
12297|  1.56k|{
12298|  1.56k|    OPJ_UINT32 compno;
12299|       |
12300|       |    /* Move data and copy one information from codec to output image*/
12301|  1.56k|    if (p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode > 0) {
  ------------------
  |  Branch (12301:9): [True: 0, False: 1.56k]
  ------------------
12302|      0|        opj_image_comp_t* newcomps =
12303|      0|            (opj_image_comp_t*) opj_malloc(
12304|      0|                p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode *
12305|      0|                sizeof(opj_image_comp_t));
12306|      0|        if (newcomps == NULL) {
  ------------------
  |  Branch (12306:13): [True: 0, False: 0]
  ------------------
12307|      0|            opj_image_destroy(p_j2k->m_private_image);
12308|      0|            p_j2k->m_private_image = NULL;
12309|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12310|      0|        }
12311|      0|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (12311:26): [True: 0, False: 0]
  ------------------
12312|      0|            opj_image_data_free(p_image->comps[compno].data);
12313|      0|            p_image->comps[compno].data = NULL;
12314|      0|        }
12315|      0|        for (compno = 0;
12316|      0|                compno < p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode; compno++) {
  ------------------
  |  Branch (12316:17): [True: 0, False: 0]
  ------------------
12317|      0|            OPJ_UINT32 src_compno =
12318|      0|                p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode[compno];
12319|      0|            memcpy(&(newcomps[compno]),
12320|      0|                   &(p_j2k->m_output_image->comps[src_compno]),
12321|      0|                   sizeof(opj_image_comp_t));
12322|      0|            newcomps[compno].resno_decoded =
12323|      0|                p_j2k->m_output_image->comps[src_compno].resno_decoded;
12324|      0|            newcomps[compno].data = p_j2k->m_output_image->comps[src_compno].data;
12325|      0|            p_j2k->m_output_image->comps[src_compno].data = NULL;
12326|      0|        }
12327|      0|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (12327:26): [True: 0, False: 0]
  ------------------
12328|      0|            assert(p_j2k->m_output_image->comps[compno].data == NULL);
12329|      0|            opj_image_data_free(p_j2k->m_output_image->comps[compno].data);
12330|      0|            p_j2k->m_output_image->comps[compno].data = NULL;
12331|      0|        }
12332|      0|        p_image->numcomps = p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode;
12333|      0|        opj_free(p_image->comps);
12334|      0|        p_image->comps = newcomps;
12335|  1.56k|    } else {
12336|  4.87k|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (12336:26): [True: 3.31k, False: 1.56k]
  ------------------
12337|  3.31k|            p_image->comps[compno].resno_decoded =
12338|  3.31k|                p_j2k->m_output_image->comps[compno].resno_decoded;
12339|  3.31k|            opj_image_data_free(p_image->comps[compno].data);
12340|  3.31k|            p_image->comps[compno].data = p_j2k->m_output_image->comps[compno].data;
12341|       |#if 0
12342|       |            char fn[256];
12343|       |            snprintf(fn, sizeof fn, "/tmp/%d.raw", compno);
12344|       |            FILE *debug = fopen(fn, "wb");
12345|       |            fwrite(p_image->comps[compno].data, sizeof(OPJ_INT32),
12346|       |                   p_image->comps[compno].w * p_image->comps[compno].h, debug);
12347|       |            fclose(debug);
12348|       |#endif
12349|  3.31k|            p_j2k->m_output_image->comps[compno].data = NULL;
12350|  3.31k|        }
12351|  1.56k|    }
12352|  1.56k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.56k|#define OPJ_TRUE 1
  ------------------
12353|  1.56k|}

opj_mct_decode:
  150|     58|{
  151|     58|    OPJ_SIZE_T i;
  152|     58|    const OPJ_SIZE_T len = n;
  153|       |
  154|  49.0k|    for (i = 0; i < (len & ~3U); i += 4) {
  ------------------
  |  Branch (154:17): [True: 48.9k, False: 58]
  ------------------
  155|  48.9k|        __m128i r, g, b;
  156|  48.9k|        __m128i y = _mm_load_si128((const __m128i *) & (c0[i]));
  157|  48.9k|        __m128i u = _mm_load_si128((const __m128i *) & (c1[i]));
  158|  48.9k|        __m128i v = _mm_load_si128((const __m128i *) & (c2[i]));
  159|  48.9k|        g = y;
  160|  48.9k|        g = _mm_sub_epi32(g, _mm_srai_epi32(_mm_add_epi32(u, v), 2));
  161|  48.9k|        r = _mm_add_epi32(v, g);
  162|  48.9k|        b = _mm_add_epi32(u, g);
  163|  48.9k|        _mm_store_si128((__m128i *) & (c0[i]), r);
  164|  48.9k|        _mm_store_si128((__m128i *) & (c1[i]), g);
  165|  48.9k|        _mm_store_si128((__m128i *) & (c2[i]), b);
  166|  48.9k|    }
  167|    107|    for (; i < len; ++i) {
  ------------------
  |  Branch (167:12): [True: 49, False: 58]
  ------------------
  168|     49|        OPJ_INT32 y = c0[i];
  169|     49|        OPJ_INT32 u = c1[i];
  170|     49|        OPJ_INT32 v = c2[i];
  171|     49|        OPJ_INT32 g = y - ((u + v) >> 2);
  172|     49|        OPJ_INT32 r = v + g;
  173|     49|        OPJ_INT32 b = u + g;
  174|     49|        c0[i] = r;
  175|     49|        c1[i] = g;
  176|     49|        c2[i] = b;
  177|     49|    }
  178|     58|}
opj_mct_decode_real:
  287|    213|{
  288|    213|    OPJ_SIZE_T i;
  289|    213|#ifdef __SSE__
  290|    213|    __m128 vrv, vgu, vgv, vbu;
  291|    213|    vrv = _mm_set1_ps(1.402f);
  292|    213|    vgu = _mm_set1_ps(0.34413f);
  293|    213|    vgv = _mm_set1_ps(0.71414f);
  294|    213|    vbu = _mm_set1_ps(1.772f);
  295|  30.9k|    for (i = 0; i < (n >> 3); ++i) {
  ------------------
  |  Branch (295:17): [True: 30.7k, False: 213]
  ------------------
  296|  30.7k|        __m128 vy, vu, vv;
  297|  30.7k|        __m128 vr, vg, vb;
  298|       |
  299|  30.7k|        vy = _mm_load_ps(c0);
  300|  30.7k|        vu = _mm_load_ps(c1);
  301|  30.7k|        vv = _mm_load_ps(c2);
  302|  30.7k|        vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
  303|  30.7k|        vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
  304|  30.7k|        vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
  305|  30.7k|        _mm_store_ps(c0, vr);
  306|  30.7k|        _mm_store_ps(c1, vg);
  307|  30.7k|        _mm_store_ps(c2, vb);
  308|  30.7k|        c0 += 4;
  309|  30.7k|        c1 += 4;
  310|  30.7k|        c2 += 4;
  311|       |
  312|  30.7k|        vy = _mm_load_ps(c0);
  313|  30.7k|        vu = _mm_load_ps(c1);
  314|  30.7k|        vv = _mm_load_ps(c2);
  315|  30.7k|        vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
  316|  30.7k|        vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
  317|  30.7k|        vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
  318|  30.7k|        _mm_store_ps(c0, vr);
  319|  30.7k|        _mm_store_ps(c1, vg);
  320|  30.7k|        _mm_store_ps(c2, vb);
  321|  30.7k|        c0 += 4;
  322|  30.7k|        c1 += 4;
  323|  30.7k|        c2 += 4;
  324|  30.7k|    }
  325|    213|    n &= 7;
  326|    213|#endif
  327|    578|    for (i = 0; i < n; ++i) {
  ------------------
  |  Branch (327:17): [True: 365, False: 213]
  ------------------
  328|    365|        OPJ_FLOAT32 y = c0[i];
  329|    365|        OPJ_FLOAT32 u = c1[i];
  330|    365|        OPJ_FLOAT32 v = c2[i];
  331|    365|        OPJ_FLOAT32 r = y + (v * 1.402f);
  332|    365|        OPJ_FLOAT32 g = y - (u * 0.34413f) - (v * (0.71414f));
  333|    365|        OPJ_FLOAT32 b = y + (u * 1.772f);
  334|    365|        c0[i] = r;
  335|    365|        c1[i] = g;
  336|    365|        c2[i] = b;
  337|    365|    }
  338|    213|}

opj_mqc_init_dec:
  441|  17.1k|{
  442|       |    /* Implements ISO 15444-1 C.3.5 Initialization of the decoder (INITDEC) */
  443|       |    /* Note: alternate "J.1 - Initialization of the software-conventions */
  444|       |    /* decoder" has been tried, but does */
  445|       |    /* not bring any improvement. */
  446|       |    /* See https://github.com/uclouvain/openjpeg/issues/921 */
  447|  17.1k|    opj_mqc_init_dec_common(mqc, bp, len, extra_writable_bytes);
  448|  17.1k|    opj_mqc_setcurctx(mqc, 0);
  ------------------
  |  |  139|  17.1k|#define opj_mqc_setcurctx(mqc, ctxno)   (mqc)->curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  ------------------
  449|  17.1k|    mqc->end_of_byte_stream_counter = 0;
  450|  17.1k|    if (len == 0) {
  ------------------
  |  Branch (450:9): [True: 5.14k, False: 12.0k]
  ------------------
  451|  5.14k|        mqc->c = 0xff << 16;
  452|  12.0k|    } else {
  453|  12.0k|        mqc->c = (OPJ_UINT32)(*mqc->bp << 16);
  454|  12.0k|    }
  455|       |
  456|  17.1k|    opj_mqc_bytein(mqc);
  457|  17.1k|    mqc->c <<= 7;
  458|  17.1k|    mqc->ct -= 7;
  459|  17.1k|    mqc->a = 0x8000;
  460|  17.1k|}
opj_mqc_raw_init_dec:
  465|  1.57k|{
  466|  1.57k|    opj_mqc_init_dec_common(mqc, bp, len, extra_writable_bytes);
  467|  1.57k|    mqc->c = 0;
  468|  1.57k|    mqc->ct = 0;
  469|  1.57k|}
opq_mqc_finish_dec:
  473|  18.7k|{
  474|       |    /* Restore the bytes overwritten by opj_mqc_init_dec_common() */
  475|  18.7k|    memcpy(mqc->end, mqc->backup, OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  18.7k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  476|  18.7k|}
opj_mqc_resetstates:
  479|  1.30M|{
  480|  1.30M|    OPJ_UINT32 i;
  481|  26.0M|    for (i = 0; i < MQC_NUMCTXS; i++) {
  ------------------
  |  |   69|  26.0M|#define MQC_NUMCTXS 19
  ------------------
  |  Branch (481:17): [True: 24.7M, False: 1.30M]
  ------------------
  482|  24.7M|        mqc->ctxs[i] = mqc_states;
  483|  24.7M|    }
  484|  1.30M|}
opj_mqc_setstate:
  488|  3.90M|{
  489|  3.90M|    mqc->ctxs[ctxno] = &mqc_states[msb + (OPJ_UINT32)(prob << 1)];
  490|  3.90M|}
mqc.c:opj_mqc_init_dec_common:
  424|  18.7k|{
  425|  18.7k|    (void)extra_writable_bytes;
  426|       |
  427|  18.7k|    assert(extra_writable_bytes >= OPJ_COMMON_CBLK_DATA_EXTRA);
  428|  18.7k|    mqc->start = bp;
  429|  18.7k|    mqc->end = bp + len;
  430|       |    /* Insert an artificial 0xFF 0xFF marker at end of the code block */
  431|       |    /* data so that the bytein routines stop on it. This saves us comparing */
  432|       |    /* the bp and end pointers */
  433|       |    /* But before inserting it, backup th bytes we will overwrite */
  434|  18.7k|    memcpy(mqc->backup, mqc->end, OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  18.7k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  435|  18.7k|    mqc->end[0] = 0xFF;
  436|  18.7k|    mqc->end[1] = 0xFF;
  437|  18.7k|    mqc->bp = bp;
  438|  18.7k|}

t1.c:opj_mqc_raw_decode:
   75|  1.43M|{
   76|  1.43M|    OPJ_UINT32 d;
   77|  1.43M|    if (mqc->ct == 0) {
  ------------------
  |  Branch (77:9): [True: 180k, False: 1.25M]
  ------------------
   78|       |        /* Given opj_mqc_raw_init_dec() we know that at some point we will */
   79|       |        /* have a 0xFF 0xFF artificial marker */
   80|   180k|        if (mqc->c == 0xff) {
  ------------------
  |  Branch (80:13): [True: 175k, False: 5.24k]
  ------------------
   81|   175k|            if (*mqc->bp  > 0x8f) {
  ------------------
  |  Branch (81:17): [True: 174k, False: 1.11k]
  ------------------
   82|   174k|                mqc->c = 0xff;
   83|   174k|                mqc->ct = 8;
   84|   174k|            } else {
   85|  1.11k|                mqc->c = *mqc->bp;
   86|  1.11k|                mqc->bp ++;
   87|  1.11k|                mqc->ct = 7;
   88|  1.11k|            }
   89|   175k|        } else {
   90|  5.24k|            mqc->c = *mqc->bp;
   91|  5.24k|            mqc->bp ++;
   92|  5.24k|            mqc->ct = 8;
   93|  5.24k|        }
   94|   180k|    }
   95|  1.43M|    mqc->ct--;
   96|  1.43M|    d = ((OPJ_UINT32)mqc->c >> mqc->ct) & 0x01U;
   97|       |
   98|  1.43M|    return d;
   99|  1.43M|}
mqc.c:opj_mqc_bytein:
  176|  17.1k|{
  177|  17.1k|    opj_mqc_bytein_macro(mqc, mqc->c, mqc->ct);
  ------------------
  |  |  102|  17.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  103|  17.1k|{ \
  |  |  104|  17.1k|        OPJ_UINT32 l_c;  \
  |  |  105|  17.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  106|  17.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  107|  17.1k|        l_c = *(mqc->bp + 1); \
  |  |  108|  17.1k|        if (*mqc->bp == 0xff) { \
  |  |  ------------------
  |  |  |  Branch (108:13): [True: 5.63k, False: 11.5k]
  |  |  ------------------
  |  |  109|  5.63k|            if (l_c > 0x8f) { \
  |  |  ------------------
  |  |  |  Branch (109:17): [True: 5.36k, False: 278]
  |  |  ------------------
  |  |  110|  5.36k|                c += 0xff00; \
  |  |  111|  5.36k|                ct = 8; \
  |  |  112|  5.36k|                mqc->end_of_byte_stream_counter ++; \
  |  |  113|  5.36k|            } else { \
  |  |  114|    278|                mqc->bp++; \
  |  |  115|    278|                c += l_c << 9; \
  |  |  116|    278|                ct = 7; \
  |  |  117|    278|            } \
  |  |  118|  11.5k|        } else { \
  |  |  119|  11.5k|            mqc->bp++; \
  |  |  120|  11.5k|            c += l_c << 8; \
  |  |  121|  11.5k|            ct = 8; \
  |  |  122|  11.5k|        } \
  |  |  123|  17.1k|}
  ------------------
  178|  17.1k|}

opj_set_info_handler:
   47|  8.85k|{
   48|  8.85k|    opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
   49|  8.85k|    if (! l_codec) {
  ------------------
  |  Branch (49:9): [True: 0, False: 8.85k]
  ------------------
   50|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
   51|      0|    }
   52|       |
   53|  8.85k|    l_codec->m_event_mgr.info_handler = p_callback;
   54|  8.85k|    l_codec->m_event_mgr.m_info_data = p_user_data;
   55|       |
   56|  8.85k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
   57|  8.85k|}
opj_set_warning_handler:
   62|  8.85k|{
   63|  8.85k|    opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
   64|  8.85k|    if (! l_codec) {
  ------------------
  |  Branch (64:9): [True: 0, False: 8.85k]
  ------------------
   65|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
   66|      0|    }
   67|       |
   68|  8.85k|    l_codec->m_event_mgr.warning_handler = p_callback;
   69|  8.85k|    l_codec->m_event_mgr.m_warning_data = p_user_data;
   70|       |
   71|  8.85k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
   72|  8.85k|}
opj_set_error_handler:
   77|  8.85k|{
   78|  8.85k|    opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
   79|  8.85k|    if (! l_codec) {
  ------------------
  |  Branch (79:9): [True: 0, False: 8.85k]
  ------------------
   80|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
   81|      0|    }
   82|       |
   83|  8.85k|    l_codec->m_event_mgr.error_handler = p_callback;
   84|  8.85k|    l_codec->m_event_mgr.m_error_data = p_user_data;
   85|       |
   86|  8.85k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
   87|  8.85k|}
opj_create_decompress:
  185|  8.85k|{
  186|  8.85k|    opj_codec_private_t *l_codec = 00;
  187|       |
  188|  8.85k|    l_codec = (opj_codec_private_t*) opj_calloc(1, sizeof(opj_codec_private_t));
  189|  8.85k|    if (!l_codec) {
  ------------------
  |  Branch (189:9): [True: 0, False: 8.85k]
  ------------------
  190|      0|        return 00;
  191|      0|    }
  192|       |
  193|  8.85k|    l_codec->is_decompressor = 1;
  194|       |
  195|  8.85k|    switch (p_format) {
  196|  8.85k|    case OPJ_CODEC_J2K:
  ------------------
  |  Branch (196:5): [True: 8.85k, False: 0]
  ------------------
  197|  8.85k|        l_codec->opj_dump_codec = (void (*)(void*, OPJ_INT32, FILE*)) j2k_dump;
  198|       |
  199|  8.85k|        l_codec->opj_get_codec_info = (opj_codestream_info_v2_t* (*)(
  200|  8.85k|                                           void*)) j2k_get_cstr_info;
  201|       |
  202|  8.85k|        l_codec->opj_get_codec_index = (opj_codestream_index_t* (*)(
  203|  8.85k|                                            void*)) j2k_get_cstr_index;
  204|       |
  205|  8.85k|        l_codec->m_codec_data.m_decompression.opj_decode =
  206|  8.85k|            (OPJ_BOOL(*)(void *,
  207|  8.85k|                         struct opj_stream_private *,
  208|  8.85k|                         opj_image_t*, struct opj_event_mgr *)) opj_j2k_decode;
  209|       |
  210|  8.85k|        l_codec->m_codec_data.m_decompression.opj_end_decompress =
  211|  8.85k|            (OPJ_BOOL(*)(void *,
  212|  8.85k|                         struct opj_stream_private *,
  213|  8.85k|                         struct opj_event_mgr *)) opj_j2k_end_decompress;
  214|       |
  215|  8.85k|        l_codec->m_codec_data.m_decompression.opj_read_header =
  216|  8.85k|            (OPJ_BOOL(*)(struct opj_stream_private *,
  217|  8.85k|                         void *,
  218|  8.85k|                         opj_image_t **,
  219|  8.85k|                         struct opj_event_mgr *)) opj_j2k_read_header;
  220|       |
  221|  8.85k|        l_codec->m_codec_data.m_decompression.opj_destroy =
  222|  8.85k|            (void (*)(void *))opj_j2k_destroy;
  223|       |
  224|  8.85k|        l_codec->m_codec_data.m_decompression.opj_setup_decoder =
  225|  8.85k|            (void (*)(void *, opj_dparameters_t *)) opj_j2k_setup_decoder;
  226|       |
  227|  8.85k|        l_codec->m_codec_data.m_decompression.opj_decoder_set_strict_mode =
  228|  8.85k|            (void (*)(void *, OPJ_BOOL)) opj_j2k_decoder_set_strict_mode;
  229|       |
  230|       |
  231|  8.85k|        l_codec->m_codec_data.m_decompression.opj_read_tile_header =
  232|  8.85k|            (OPJ_BOOL(*)(void *,
  233|  8.85k|                         OPJ_UINT32*,
  234|  8.85k|                         OPJ_UINT32*,
  235|  8.85k|                         OPJ_INT32*, OPJ_INT32*,
  236|  8.85k|                         OPJ_INT32*, OPJ_INT32*,
  237|  8.85k|                         OPJ_UINT32*,
  238|  8.85k|                         OPJ_BOOL*,
  239|  8.85k|                         struct opj_stream_private *,
  240|  8.85k|                         struct opj_event_mgr *)) opj_j2k_read_tile_header;
  241|       |
  242|  8.85k|        l_codec->m_codec_data.m_decompression.opj_decode_tile_data =
  243|  8.85k|            (OPJ_BOOL(*)(void *,
  244|  8.85k|                         OPJ_UINT32,
  245|  8.85k|                         OPJ_BYTE*,
  246|  8.85k|                         OPJ_UINT32,
  247|  8.85k|                         struct opj_stream_private *,
  248|  8.85k|                         struct opj_event_mgr *)) opj_j2k_decode_tile;
  249|       |
  250|  8.85k|        l_codec->m_codec_data.m_decompression.opj_set_decode_area =
  251|  8.85k|            (OPJ_BOOL(*)(void *,
  252|  8.85k|                         opj_image_t*,
  253|  8.85k|                         OPJ_INT32, OPJ_INT32, OPJ_INT32, OPJ_INT32,
  254|  8.85k|                         struct opj_event_mgr *)) opj_j2k_set_decode_area;
  255|       |
  256|  8.85k|        l_codec->m_codec_data.m_decompression.opj_get_decoded_tile =
  257|  8.85k|            (OPJ_BOOL(*)(void *p_codec,
  258|  8.85k|                         opj_stream_private_t *p_cio,
  259|  8.85k|                         opj_image_t *p_image,
  260|  8.85k|                         struct opj_event_mgr * p_manager,
  261|  8.85k|                         OPJ_UINT32 tile_index)) opj_j2k_get_tile;
  262|       |
  263|  8.85k|        l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor =
  264|  8.85k|            (OPJ_BOOL(*)(void * p_codec,
  265|  8.85k|                         OPJ_UINT32 res_factor,
  266|  8.85k|                         struct opj_event_mgr * p_manager)) opj_j2k_set_decoded_resolution_factor;
  267|       |
  268|  8.85k|        l_codec->m_codec_data.m_decompression.opj_set_decoded_components =
  269|  8.85k|            (OPJ_BOOL(*)(void * p_codec,
  270|  8.85k|                         OPJ_UINT32 numcomps,
  271|  8.85k|                         const OPJ_UINT32 * comps_indices,
  272|  8.85k|                         struct opj_event_mgr * p_manager)) opj_j2k_set_decoded_components;
  273|       |
  274|  8.85k|        l_codec->opj_set_threads =
  275|  8.85k|            (OPJ_BOOL(*)(void * p_codec, OPJ_UINT32 num_threads)) opj_j2k_set_threads;
  276|       |
  277|  8.85k|        l_codec->m_codec = opj_j2k_create_decompress();
  278|       |
  279|  8.85k|        if (! l_codec->m_codec) {
  ------------------
  |  Branch (279:13): [True: 0, False: 8.85k]
  ------------------
  280|      0|            opj_free(l_codec);
  281|      0|            return NULL;
  282|      0|        }
  283|       |
  284|  8.85k|        break;
  285|       |
  286|  8.85k|    case OPJ_CODEC_JP2:
  ------------------
  |  Branch (286:5): [True: 0, False: 8.85k]
  ------------------
  287|       |        /* get a JP2 decoder handle */
  288|      0|        l_codec->opj_dump_codec = (void (*)(void*, OPJ_INT32, FILE*)) jp2_dump;
  289|       |
  290|      0|        l_codec->opj_get_codec_info = (opj_codestream_info_v2_t* (*)(
  291|      0|                                           void*)) jp2_get_cstr_info;
  292|       |
  293|      0|        l_codec->opj_get_codec_index = (opj_codestream_index_t* (*)(
  294|      0|                                            void*)) jp2_get_cstr_index;
  295|       |
  296|      0|        l_codec->m_codec_data.m_decompression.opj_decode =
  297|      0|            (OPJ_BOOL(*)(void *,
  298|      0|                         struct opj_stream_private *,
  299|      0|                         opj_image_t*,
  300|      0|                         struct opj_event_mgr *)) opj_jp2_decode;
  301|       |
  302|      0|        l_codec->m_codec_data.m_decompression.opj_end_decompress =
  303|      0|            (OPJ_BOOL(*)(void *,
  304|      0|                         struct opj_stream_private *,
  305|      0|                         struct opj_event_mgr *)) opj_jp2_end_decompress;
  306|       |
  307|      0|        l_codec->m_codec_data.m_decompression.opj_read_header =
  308|      0|            (OPJ_BOOL(*)(struct opj_stream_private *,
  309|      0|                         void *,
  310|      0|                         opj_image_t **,
  311|      0|                         struct opj_event_mgr *)) opj_jp2_read_header;
  312|       |
  313|      0|        l_codec->m_codec_data.m_decompression.opj_read_tile_header =
  314|      0|            (OPJ_BOOL(*)(void *,
  315|      0|                         OPJ_UINT32*,
  316|      0|                         OPJ_UINT32*,
  317|      0|                         OPJ_INT32*,
  318|      0|                         OPJ_INT32*,
  319|      0|                         OPJ_INT32 *,
  320|      0|                         OPJ_INT32 *,
  321|      0|                         OPJ_UINT32 *,
  322|      0|                         OPJ_BOOL *,
  323|      0|                         struct opj_stream_private *,
  324|      0|                         struct opj_event_mgr *)) opj_jp2_read_tile_header;
  325|       |
  326|      0|        l_codec->m_codec_data.m_decompression.opj_decode_tile_data =
  327|      0|            (OPJ_BOOL(*)(void *,
  328|      0|                         OPJ_UINT32, OPJ_BYTE*, OPJ_UINT32,
  329|      0|                         struct opj_stream_private *,
  330|      0|                         struct opj_event_mgr *)) opj_jp2_decode_tile;
  331|       |
  332|      0|        l_codec->m_codec_data.m_decompression.opj_destroy = (void (*)(
  333|      0|                    void *))opj_jp2_destroy;
  334|       |
  335|      0|        l_codec->m_codec_data.m_decompression.opj_setup_decoder =
  336|      0|            (void (*)(void *, opj_dparameters_t *)) opj_jp2_setup_decoder;
  337|       |
  338|      0|        l_codec->m_codec_data.m_decompression.opj_decoder_set_strict_mode =
  339|      0|            (void (*)(void *, OPJ_BOOL)) opj_jp2_decoder_set_strict_mode;
  340|       |
  341|      0|        l_codec->m_codec_data.m_decompression.opj_set_decode_area =
  342|      0|            (OPJ_BOOL(*)(void *,
  343|      0|                         opj_image_t*,
  344|      0|                         OPJ_INT32, OPJ_INT32, OPJ_INT32, OPJ_INT32,
  345|      0|                         struct opj_event_mgr *)) opj_jp2_set_decode_area;
  346|       |
  347|      0|        l_codec->m_codec_data.m_decompression.opj_get_decoded_tile =
  348|      0|            (OPJ_BOOL(*)(void *p_codec,
  349|      0|                         opj_stream_private_t *p_cio,
  350|      0|                         opj_image_t *p_image,
  351|      0|                         struct opj_event_mgr * p_manager,
  352|      0|                         OPJ_UINT32 tile_index)) opj_jp2_get_tile;
  353|       |
  354|      0|        l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor =
  355|      0|            (OPJ_BOOL(*)(void * p_codec,
  356|      0|                         OPJ_UINT32 res_factor,
  357|      0|                         opj_event_mgr_t * p_manager)) opj_jp2_set_decoded_resolution_factor;
  358|       |
  359|      0|        l_codec->m_codec_data.m_decompression.opj_set_decoded_components =
  360|      0|            (OPJ_BOOL(*)(void * p_codec,
  361|      0|                         OPJ_UINT32 numcomps,
  362|      0|                         const OPJ_UINT32 * comps_indices,
  363|      0|                         struct opj_event_mgr * p_manager)) opj_jp2_set_decoded_components;
  364|       |
  365|      0|        l_codec->opj_set_threads =
  366|      0|            (OPJ_BOOL(*)(void * p_codec, OPJ_UINT32 num_threads)) opj_jp2_set_threads;
  367|       |
  368|      0|        l_codec->m_codec = opj_jp2_create(OPJ_TRUE);
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  369|       |
  370|      0|        if (! l_codec->m_codec) {
  ------------------
  |  Branch (370:13): [True: 0, False: 0]
  ------------------
  371|      0|            opj_free(l_codec);
  372|      0|            return 00;
  373|      0|        }
  374|       |
  375|      0|        break;
  376|      0|    case OPJ_CODEC_UNKNOWN:
  ------------------
  |  Branch (376:5): [True: 0, False: 8.85k]
  ------------------
  377|      0|    case OPJ_CODEC_JPT:
  ------------------
  |  Branch (377:5): [True: 0, False: 8.85k]
  ------------------
  378|      0|    default:
  ------------------
  |  Branch (378:5): [True: 0, False: 8.85k]
  ------------------
  379|      0|        opj_free(l_codec);
  380|      0|        return 00;
  381|  8.85k|    }
  382|       |
  383|  8.85k|    opj_set_default_event_handler(&(l_codec->m_event_mgr));
  384|  8.85k|    return (opj_codec_t*) l_codec;
  385|  8.85k|}
opj_set_default_decoder_parameters:
  389|  8.85k|{
  390|  8.85k|    if (parameters) {
  ------------------
  |  Branch (390:9): [True: 8.85k, False: 0]
  ------------------
  391|  8.85k|        memset(parameters, 0, sizeof(opj_dparameters_t));
  392|       |        /* default decoding parameters */
  393|  8.85k|        parameters->cp_layer = 0;
  394|  8.85k|        parameters->cp_reduce = 0;
  395|       |
  396|  8.85k|        parameters->decod_format = -1;
  397|  8.85k|        parameters->cod_format = -1;
  398|  8.85k|        parameters->flags = 0;
  399|       |        /* UniPG>> */
  400|       |#ifdef USE_JPWL
  401|       |        parameters->jpwl_correct = OPJ_FALSE;
  402|       |        parameters->jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
  403|       |        parameters->jpwl_max_tiles = JPWL_MAXIMUM_TILES;
  404|       |#endif /* USE_JPWL */
  405|       |        /* <<UniPG */
  406|  8.85k|    }
  407|  8.85k|}
opj_setup_decoder:
  424|  8.85k|{
  425|  8.85k|    if (p_codec && parameters) {
  ------------------
  |  Branch (425:9): [True: 8.85k, False: 0]
  |  Branch (425:20): [True: 8.85k, False: 0]
  ------------------
  426|  8.85k|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
  427|       |
  428|  8.85k|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (428:13): [True: 0, False: 8.85k]
  ------------------
  429|      0|            opj_event_msg(&(l_codec->m_event_mgr), EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  430|      0|                          "Codec provided to the opj_setup_decoder function is not a decompressor handler.\n");
  431|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  432|      0|        }
  433|       |
  434|  8.85k|        l_codec->m_codec_data.m_decompression.opj_setup_decoder(l_codec->m_codec,
  435|  8.85k|                parameters);
  436|  8.85k|        return OPJ_TRUE;
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
  437|  8.85k|    }
  438|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  439|  8.85k|}
opj_read_header:
  464|  8.85k|{
  465|  8.85k|    if (p_codec && p_stream) {
  ------------------
  |  Branch (465:9): [True: 8.85k, False: 0]
  |  Branch (465:20): [True: 8.85k, False: 0]
  ------------------
  466|  8.85k|        opj_codec_private_t* l_codec = (opj_codec_private_t*) p_codec;
  467|  8.85k|        opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  468|       |
  469|  8.85k|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (469:13): [True: 0, False: 8.85k]
  ------------------
  470|      0|            opj_event_msg(&(l_codec->m_event_mgr), EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  471|      0|                          "Codec provided to the opj_read_header function is not a decompressor handler.\n");
  472|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  473|      0|        }
  474|       |
  475|  8.85k|        return l_codec->m_codec_data.m_decompression.opj_read_header(l_stream,
  476|  8.85k|                l_codec->m_codec,
  477|  8.85k|                p_image,
  478|  8.85k|                &(l_codec->m_event_mgr));
  479|  8.85k|    }
  480|       |
  481|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  482|  8.85k|}
opj_decode:
  517|  7.44k|{
  518|  7.44k|    if (p_codec && p_stream) {
  ------------------
  |  Branch (518:9): [True: 7.44k, False: 0]
  |  Branch (518:20): [True: 7.44k, False: 0]
  ------------------
  519|  7.44k|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
  520|  7.44k|        opj_stream_private_t * l_stream = (opj_stream_private_t *) p_stream;
  521|       |
  522|  7.44k|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (522:13): [True: 0, False: 7.44k]
  ------------------
  523|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  524|      0|        }
  525|       |
  526|  7.44k|        return l_codec->m_codec_data.m_decompression.opj_decode(l_codec->m_codec,
  527|  7.44k|                l_stream,
  528|  7.44k|                p_image,
  529|  7.44k|                &(l_codec->m_event_mgr));
  530|  7.44k|    }
  531|       |
  532|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  533|  7.44k|}
opj_set_decode_area:
  540|  7.47k|{
  541|  7.47k|    if (p_codec) {
  ------------------
  |  Branch (541:9): [True: 7.47k, False: 0]
  ------------------
  542|  7.47k|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
  543|       |
  544|  7.47k|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (544:13): [True: 0, False: 7.47k]
  ------------------
  545|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  546|      0|        }
  547|       |
  548|  7.47k|        return  l_codec->m_codec_data.m_decompression.opj_set_decode_area(
  549|  7.47k|                    l_codec->m_codec,
  550|  7.47k|                    p_image,
  551|  7.47k|                    p_start_x, p_start_y,
  552|  7.47k|                    p_end_x, p_end_y,
  553|  7.47k|                    &(l_codec->m_event_mgr));
  554|  7.47k|    }
  555|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  556|  7.47k|}
opj_end_decompress:
  926|  7.47k|{
  927|  7.47k|    if (p_codec && p_stream) {
  ------------------
  |  Branch (927:9): [True: 7.47k, False: 0]
  |  Branch (927:20): [True: 7.47k, False: 0]
  ------------------
  928|  7.47k|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
  929|  7.47k|        opj_stream_private_t * l_stream = (opj_stream_private_t *) p_stream;
  930|       |
  931|  7.47k|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (931:13): [True: 0, False: 7.47k]
  ------------------
  932|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  933|      0|        }
  934|       |
  935|  7.47k|        return l_codec->m_codec_data.m_decompression.opj_end_decompress(
  936|  7.47k|                   l_codec->m_codec,
  937|  7.47k|                   l_stream,
  938|  7.47k|                   &(l_codec->m_event_mgr));
  939|  7.47k|    }
  940|       |
  941|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  942|  7.47k|}
opj_destroy_codec:
 1002|  8.85k|{
 1003|  8.85k|    if (p_codec) {
  ------------------
  |  Branch (1003:9): [True: 8.85k, False: 0]
  ------------------
 1004|  8.85k|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
 1005|       |
 1006|  8.85k|        if (l_codec->is_decompressor) {
  ------------------
  |  Branch (1006:13): [True: 8.85k, False: 0]
  ------------------
 1007|  8.85k|            l_codec->m_codec_data.m_decompression.opj_destroy(l_codec->m_codec);
 1008|  8.85k|        } else {
 1009|      0|            l_codec->m_codec_data.m_compression.opj_destroy(l_codec->m_codec);
 1010|      0|        }
 1011|       |
 1012|  8.85k|        l_codec->m_codec = 00;
 1013|  8.85k|        opj_free(l_codec);
 1014|  8.85k|    }
 1015|  8.85k|}
opj_image_data_alloc:
 1134|  20.7k|{
 1135|  20.7k|    void* ret = opj_aligned_malloc(size);
 1136|       |    /* printf("opj_image_data_alloc %p\n", ret); */
 1137|  20.7k|    return ret;
 1138|  20.7k|}
opj_image_data_free:
 1141|  70.8k|{
 1142|       |    /* printf("opj_image_data_free %p\n", ptr); */
 1143|  70.8k|    opj_aligned_free(ptr);
 1144|  70.8k|}

tcd.c:opj_lrintf:
  177|   120M|{
  178|   120M|    return lrintf(f);
  179|   120M|}

image.c:opj_uint_max:
   84|  17.0k|{
   85|  17.0k|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 0, False: 17.0k]
  ------------------
   86|  17.0k|}
image.c:opj_uint_min:
   66|  17.0k|{
   67|  17.0k|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 0, False: 17.0k]
  ------------------
   68|  17.0k|}
image.c:opj_uint_adds:
   93|  17.0k|{
   94|  17.0k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  17.0k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  17.0k|}
image.c:opj_uint_ceildiv:
  171|   123k|{
  172|   123k|    assert(b);
  173|   123k|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|   123k|}
image.c:opj_uint_ceildivpow2:
  210|  61.6k|{
  211|  61.6k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  61.6k|}
j2k.c:opj_uint_ceildiv:
  171|  77.8k|{
  172|  77.8k|    assert(b);
  173|  77.8k|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|  77.8k|}
j2k.c:opj_uint_min:
   66|  8.21k|{
   67|  8.21k|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 2.21k, False: 5.99k]
  ------------------
   68|  8.21k|}
j2k.c:opj_uint_adds:
   93|  17.2k|{
   94|  17.2k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  17.2k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  17.2k|}
j2k.c:opj_uint_ceildivpow2:
  210|  16.9k|{
  211|  16.9k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  16.9k|}
j2k.c:opj_int_ceildiv:
  161|  45.9k|{
  162|  45.9k|    assert(b);
  163|  45.9k|    return (OPJ_INT32)(((OPJ_INT64)a + b - 1) / b);
  164|  45.9k|}
j2k.c:opj_int_ceildivpow2:
  192|  91.8k|{
  193|  91.8k|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  194|  91.8k|}
pi.c:opj_uint_max:
   84|  14.6k|{
   85|  14.6k|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 932, False: 13.6k]
  ------------------
   86|  14.6k|}
pi.c:opj_uint_min:
   66|  4.56M|{
   67|  4.56M|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 279k, False: 4.28M]
  ------------------
   68|  4.56M|}
pi.c:opj_uint_adds:
   93|  14.6k|{
   94|  14.6k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  14.6k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  14.6k|}
pi.c:opj_uint_ceildiv:
  171|  95.0k|{
  172|  95.0k|    assert(b);
  173|  95.0k|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|  95.0k|}
pi.c:opj_uint_ceildivpow2:
  210|  1.22M|{
  211|  1.22M|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  1.22M|}
pi.c:opj_uint_floordivpow2:
  228|  1.19M|{
  229|  1.19M|    return a >> b;
  230|  1.19M|}
pi.c:opj_uint64_ceildiv_res_uint32:
  182|  10.6M|{
  183|  10.6M|    assert(b);
  184|  10.6M|    return (OPJ_UINT32)((a + b - 1) / b);
  185|  10.6M|}
tcd.c:opj_int_ceildiv:
  161|  95.4k|{
  162|  95.4k|    assert(b);
  163|  95.4k|    return (OPJ_INT32)(((OPJ_INT64)a + b - 1) / b);
  164|  95.4k|}
tcd.c:opj_int_ceildivpow2:
  192|  62.7M|{
  193|  62.7M|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  194|  62.7M|}
tcd.c:opj_int_floordivpow2:
  219|  61.4M|{
  220|  61.4M|    return a >> b;
  221|  61.4M|}
tcd.c:opj_int64_ceildivpow2:
  201|  2.16M|{
  202|  2.16M|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  203|  2.16M|}
tcd.c:opj_int_max:
   75|   603M|{
   76|   603M|    return (a > b) ? a : b;
  ------------------
  |  Branch (76:12): [True: 324M, False: 278M]
  ------------------
   77|   603M|}
tcd.c:opj_int_min:
   57|   603M|{
   58|   603M|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 324M, False: 278M]
  ------------------
   59|   603M|}
tcd.c:opj_uint_max:
   84|   147M|{
   85|   147M|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 6.15M, False: 141M]
  ------------------
   86|   147M|}
tcd.c:opj_uint_ceildiv:
  171|   294M|{
  172|   294M|    assert(b);
  173|   294M|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|   294M|}
tcd.c:opj_uint_min:
   66|   147M|{
   67|   147M|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 11.7M, False: 136M]
  ------------------
   68|   147M|}
tcd.c:opj_uint_ceildivpow2:
  210|   209M|{
  211|   209M|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|   209M|}
tcd.c:opj_int_clamp:
  118|   250M|{
  119|   250M|    if (a < min) {
  ------------------
  |  Branch (119:9): [True: 603k, False: 250M]
  ------------------
  120|   603k|        return min;
  121|   603k|    }
  122|   250M|    if (a > max) {
  ------------------
  |  Branch (122:9): [True: 657k, False: 249M]
  ------------------
  123|   657k|        return max;
  124|   657k|    }
  125|   249M|    return a;
  126|   250M|}
tcd.c:opj_int64_clamp:
  139|   120M|{
  140|   120M|    if (a < min) {
  ------------------
  |  Branch (140:9): [True: 175k, False: 120M]
  ------------------
  141|   175k|        return min;
  142|   175k|    }
  143|   120M|    if (a > max) {
  ------------------
  |  Branch (143:9): [True: 196k, False: 120M]
  ------------------
  144|   196k|        return max;
  145|   196k|    }
  146|   120M|    return a;
  147|   120M|}
tcd.c:opj_uint_adds:
   93|   147M|{
   94|   147M|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|   147M|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|   147M|}
dwt.c:opj_uint_min:
   66|   925k|{
   67|   925k|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 561k, False: 364k]
  ------------------
   68|   925k|}
dwt.c:opj_int_min:
   57|   484k|{
   58|   484k|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 0, False: 484k]
  ------------------
   59|   484k|}
dwt.c:opj_int_add_no_overflow:
  298|   111M|{
  299|   111M|    void* pa = &a;
  300|   111M|    void* pb = &b;
  301|   111M|    OPJ_UINT32* upa = (OPJ_UINT32*)pa;
  302|   111M|    OPJ_UINT32* upb = (OPJ_UINT32*)pb;
  303|   111M|    OPJ_UINT32 ures = *upa + *upb;
  304|   111M|    void* pures = &ures;
  305|   111M|    OPJ_INT32* ipres = (OPJ_INT32*)pures;
  306|   111M|    return *ipres;
  307|   111M|}
dwt.c:opj_int_sub_no_overflow:
  317|  15.0M|{
  318|  15.0M|    void* pa = &a;
  319|  15.0M|    void* pb = &b;
  320|  15.0M|    OPJ_UINT32* upa = (OPJ_UINT32*)pa;
  321|  15.0M|    OPJ_UINT32* upb = (OPJ_UINT32*)pb;
  322|  15.0M|    OPJ_UINT32 ures = *upa - *upb;
  323|  15.0M|    void* pures = &ures;
  324|  15.0M|    OPJ_INT32* ipres = (OPJ_INT32*)pures;
  325|  15.0M|    return *ipres;
  326|  15.0M|}
dwt.c:opj_uint_ceildivpow2:
  210|   132k|{
  211|   132k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|   132k|}
dwt.c:opj_uint_subs:
  103|   307k|{
  104|   307k|    return (a >= b) ? a - b : 0;
  ------------------
  |  Branch (104:12): [True: 204k, False: 102k]
  ------------------
  105|   307k|}
dwt.c:opj_uint_adds:
   93|   102k|{
   94|   102k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|   102k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|   102k|}
dwt.c:opj_uint_max:
   84|  51.1k|{
   85|  51.1k|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 15.9k, False: 35.2k]
  ------------------
   86|  51.1k|}
t2.c:opj_uint_max:
   84|  17.6M|{
   85|  17.6M|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 36.7k, False: 17.6M]
  ------------------
   86|  17.6M|}
t2.c:opj_uint_floorlog2:
  249|  73.8k|{
  250|  73.8k|    OPJ_UINT32  l;
  251|   128k|    for (l = 0; a > 1; ++l) {
  ------------------
  |  Branch (251:17): [True: 55.1k, False: 73.8k]
  ------------------
  252|  55.1k|        a >>= 1;
  253|  55.1k|    }
  254|  73.8k|    return l;
  255|  73.8k|}
t2.c:opj_int_min:
   57|  69.8k|{
   58|  69.8k|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 10.2k, False: 59.5k]
  ------------------
   59|  69.8k|}
sparse_array.c:opj_uint_ceildiv:
  171|  7.15k|{
  172|  7.15k|    assert(b);
  173|  7.15k|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|  7.15k|}
sparse_array.c:opj_uint_min:
   66|  27.0M|{
   67|  27.0M|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 10.9M, False: 16.1M]
  ------------------
   68|  27.0M|}

opj_malloc:
  192|  98.7M|{
  193|  98.7M|    if (size == 0U) { /* prevent implementation defined behavior of realloc */
  ------------------
  |  Branch (193:9): [True: 1, False: 98.7M]
  ------------------
  194|      1|        return NULL;
  195|      1|    }
  196|  98.7M|    return malloc(size);
  197|  98.7M|}
opj_calloc:
  199|   408M|{
  200|   408M|    if (num == 0 || size == 0) {
  ------------------
  |  Branch (200:9): [True: 40, False: 408M]
  |  Branch (200:21): [True: 0, False: 408M]
  ------------------
  201|       |        /* prevent implementation defined behavior of realloc */
  202|     40|        return NULL;
  203|     40|    }
  204|   408M|    return calloc(num, size);
  205|   408M|}
opj_aligned_malloc:
  208|   622k|{
  209|   622k|    return opj_aligned_alloc_n(16U, size);
  210|   622k|}
opj_aligned_32_malloc:
  217|  5.60k|{
  218|  5.60k|    return opj_aligned_alloc_n(32U, size);
  219|  5.60k|}
opj_aligned_free:
  226|   271M|{
  227|   271M|#if defined(OPJ_HAVE_POSIX_MEMALIGN) || defined(OPJ_HAVE_MEMALIGN)
  228|   271M|    free(ptr);
  229|       |#elif defined(OPJ_HAVE__ALIGNED_MALLOC)
  230|       |    _aligned_free(ptr);
  231|       |#else
  232|       |    /* Generic implementation has malloced pointer stored in front of used area */
  233|       |    if (ptr != NULL) {
  234|       |        free(((void**) ptr)[-1]);
  235|       |    }
  236|       |#endif
  237|   271M|}
opj_realloc:
  240|  44.6k|{
  241|  44.6k|    if (new_size == 0U) { /* prevent implementation defined behavior of realloc */
  ------------------
  |  Branch (241:9): [True: 0, False: 44.6k]
  ------------------
  242|      0|        return NULL;
  243|      0|    }
  244|  44.6k|    return realloc(ptr, new_size);
  245|  44.6k|}
opj_free:
  247|   507M|{
  248|   507M|    free(ptr);
  249|   507M|}
opj_malloc.c:opj_aligned_alloc_n:
   44|   627k|{
   45|   627k|    void* ptr;
   46|       |
   47|       |    /* alignment shall be power of 2 */
   48|   627k|    assert((alignment != 0U) && ((alignment & (alignment - 1U)) == 0U));
   49|       |    /* alignment shall be at least sizeof(void*) */
   50|   627k|    assert(alignment >= sizeof(void*));
   51|       |
   52|   627k|    if (size == 0U) { /* prevent implementation defined behavior of realloc */
  ------------------
  |  Branch (52:9): [True: 3.31k, False: 624k]
  ------------------
   53|  3.31k|        return NULL;
   54|  3.31k|    }
   55|       |
   56|   624k|#if defined(OPJ_HAVE_POSIX_MEMALIGN)
   57|       |    /* aligned_alloc requires c11, restrict to posix_memalign for now. Quote:
   58|       |     * This function was introduced in POSIX 1003.1d. Although this function is
   59|       |     * superseded by aligned_alloc, it is more portable to older POSIX systems
   60|       |     * that do not support ISO C11.  */
   61|   624k|    if (posix_memalign(&ptr, alignment, size)) {
  ------------------
  |  Branch (61:9): [True: 0, False: 624k]
  ------------------
   62|      0|        ptr = NULL;
   63|      0|    }
   64|       |    /* older linux */
   65|       |#elif defined(OPJ_HAVE_MEMALIGN)
   66|       |    ptr = memalign(alignment, size);
   67|       |    /* _MSC_VER */
   68|       |#elif defined(OPJ_HAVE__ALIGNED_MALLOC)
   69|       |    ptr = _aligned_malloc(size, alignment);
   70|       |#else
   71|       |    /*
   72|       |     * Generic aligned malloc implementation.
   73|       |     * Uses size_t offset for the integer manipulation of the pointer,
   74|       |     * as uintptr_t is not available in C89 to do
   75|       |     * bitwise operations on the pointer itself.
   76|       |     */
   77|       |    alignment--;
   78|       |    {
   79|       |        size_t offset;
   80|       |        OPJ_UINT8 *mem;
   81|       |
   82|       |        /* Room for padding and extra pointer stored in front of allocated area */
   83|       |        size_t overhead = alignment + sizeof(void *);
   84|       |
   85|       |        /* let's be extra careful */
   86|       |        assert(alignment <= (SIZE_MAX - sizeof(void *)));
   87|       |
   88|       |        /* Avoid integer overflow */
   89|       |        if (size > (SIZE_MAX - overhead)) {
   90|       |            return NULL;
   91|       |        }
   92|       |
   93|       |        mem = (OPJ_UINT8*)malloc(size + overhead);
   94|       |        if (mem == NULL) {
   95|       |            return mem;
   96|       |        }
   97|       |        /* offset = ((alignment + 1U) - ((size_t)(mem + sizeof(void*)) & alignment)) & alignment; */
   98|       |        /* Use the fact that alignment + 1U is a power of 2 */
   99|       |        offset = ((alignment ^ ((size_t)(mem + sizeof(void*)) & alignment)) + 1U) &
  100|       |                 alignment;
  101|       |        ptr = (void *)(mem + sizeof(void*) + offset);
  102|       |        ((void**) ptr)[-1] = mem;
  103|       |    }
  104|       |#endif
  105|   624k|    return ptr;
  106|   627k|}

opj_pi_create_decode:
 1392|  7.31k|{
 1393|  7.31k|    OPJ_UINT32 numcomps = p_image->numcomps;
 1394|       |
 1395|       |    /* loop */
 1396|  7.31k|    OPJ_UINT32 pino;
 1397|  7.31k|    OPJ_UINT32 compno, resno;
 1398|       |
 1399|       |    /* to store w, h, dx and dy for all components and resolutions */
 1400|  7.31k|    OPJ_UINT32 * l_tmp_data;
 1401|  7.31k|    OPJ_UINT32 ** l_tmp_ptr;
 1402|       |
 1403|       |    /* encoding parameters to set */
 1404|  7.31k|    OPJ_UINT32 l_max_res;
 1405|  7.31k|    OPJ_UINT32 l_max_prec;
 1406|  7.31k|    OPJ_UINT32 l_tx0, l_tx1, l_ty0, l_ty1;
 1407|  7.31k|    OPJ_UINT32 l_dx_min, l_dy_min;
 1408|  7.31k|    OPJ_UINT32 l_bound;
 1409|  7.31k|    OPJ_UINT32 l_step_p, l_step_c, l_step_r, l_step_l ;
 1410|  7.31k|    OPJ_UINT32 l_data_stride;
 1411|       |
 1412|       |    /* pointers */
 1413|  7.31k|    opj_pi_iterator_t *l_pi = 00;
 1414|  7.31k|    opj_tcp_t *l_tcp = 00;
 1415|  7.31k|    const opj_tccp_t *l_tccp = 00;
 1416|  7.31k|    opj_pi_comp_t *l_current_comp = 00;
 1417|  7.31k|    opj_image_comp_t * l_img_comp = 00;
 1418|  7.31k|    opj_pi_iterator_t * l_current_pi = 00;
 1419|  7.31k|    OPJ_UINT32 * l_encoding_value_ptr = 00;
 1420|       |
 1421|       |    /* preconditions in debug */
 1422|  7.31k|    assert(p_cp != 00);
 1423|  7.31k|    assert(p_image != 00);
 1424|  7.31k|    assert(p_tile_no < p_cp->tw * p_cp->th);
 1425|       |
 1426|       |    /* initializations */
 1427|  7.31k|    l_tcp = &p_cp->tcps[p_tile_no];
 1428|  7.31k|    l_bound = l_tcp->numpocs + 1;
 1429|       |
 1430|  7.31k|    l_data_stride = 4 * OPJ_J2K_MAXRLVLS;
  ------------------
  |  |  154|  7.31k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  ------------------
 1431|  7.31k|    l_tmp_data = (OPJ_UINT32*)opj_malloc(
 1432|  7.31k|                     l_data_stride * numcomps * sizeof(OPJ_UINT32));
 1433|  7.31k|    if
 1434|  7.31k|    (! l_tmp_data) {
  ------------------
  |  Branch (1434:6): [True: 0, False: 7.31k]
  ------------------
 1435|      0|        return 00;
 1436|      0|    }
 1437|  7.31k|    l_tmp_ptr = (OPJ_UINT32**)opj_malloc(
 1438|  7.31k|                    numcomps * sizeof(OPJ_UINT32 *));
 1439|  7.31k|    if
 1440|  7.31k|    (! l_tmp_ptr) {
  ------------------
  |  Branch (1440:6): [True: 0, False: 7.31k]
  ------------------
 1441|      0|        opj_free(l_tmp_data);
 1442|      0|        return 00;
 1443|      0|    }
 1444|       |
 1445|       |    /* memory allocation for pi */
 1446|  7.31k|    l_pi = opj_pi_create(p_image, p_cp, p_tile_no, manager);
 1447|  7.31k|    if (!l_pi) {
  ------------------
  |  Branch (1447:9): [True: 0, False: 7.31k]
  ------------------
 1448|      0|        opj_free(l_tmp_data);
 1449|      0|        opj_free(l_tmp_ptr);
 1450|      0|        return 00;
 1451|      0|    }
 1452|       |
 1453|  7.31k|    l_encoding_value_ptr = l_tmp_data;
 1454|       |    /* update pointer array */
 1455|  7.31k|    for
 1456|  31.0k|    (compno = 0; compno < numcomps; ++compno) {
  ------------------
  |  Branch (1456:18): [True: 23.7k, False: 7.31k]
  ------------------
 1457|  23.7k|        l_tmp_ptr[compno] = l_encoding_value_ptr;
 1458|  23.7k|        l_encoding_value_ptr += l_data_stride;
 1459|  23.7k|    }
 1460|       |    /* get encoding parameters */
 1461|  7.31k|    opj_get_all_encoding_parameters(p_image, p_cp, p_tile_no, &l_tx0, &l_tx1,
 1462|  7.31k|                                    &l_ty0, &l_ty1, &l_dx_min, &l_dy_min, &l_max_prec, &l_max_res, l_tmp_ptr);
 1463|       |
 1464|       |    /* step calculations */
 1465|  7.31k|    l_step_p = 1;
 1466|  7.31k|    l_step_c = l_max_prec * l_step_p;
 1467|  7.31k|    l_step_r = numcomps * l_step_c;
 1468|  7.31k|    l_step_l = l_max_res * l_step_r;
 1469|       |
 1470|       |    /* set values for first packet iterator */
 1471|  7.31k|    l_current_pi = l_pi;
 1472|       |
 1473|       |    /* memory allocation for include */
 1474|       |    /* prevent an integer overflow issue */
 1475|       |    /* 0 < l_tcp->numlayers < 65536 c.f. opj_j2k_read_cod in j2k.c */
 1476|  7.31k|    l_current_pi->include = 00;
 1477|  7.31k|    if (l_step_l <= (UINT_MAX / (l_tcp->numlayers + 1U))) {
  ------------------
  |  Branch (1477:9): [True: 7.31k, False: 1]
  ------------------
 1478|  7.31k|        l_current_pi->include_size = (l_tcp->numlayers + 1U) * l_step_l;
 1479|  7.31k|        l_current_pi->include = (OPJ_INT16*) opj_calloc(
 1480|  7.31k|                                    l_current_pi->include_size, sizeof(OPJ_INT16));
 1481|  7.31k|    }
 1482|       |
 1483|  7.31k|    if (!l_current_pi->include) {
  ------------------
  |  Branch (1483:9): [True: 9, False: 7.30k]
  ------------------
 1484|      9|        opj_free(l_tmp_data);
 1485|      9|        opj_free(l_tmp_ptr);
 1486|      9|        opj_pi_destroy(l_pi, l_bound);
 1487|      9|        return 00;
 1488|      9|    }
 1489|       |
 1490|       |    /* special treatment for the first packet iterator */
 1491|  7.30k|    l_current_comp = l_current_pi->comps;
 1492|  7.30k|    l_img_comp = p_image->comps;
 1493|  7.30k|    l_tccp = l_tcp->tccps;
 1494|       |
 1495|  7.30k|    l_current_pi->tx0 = l_tx0;
 1496|  7.30k|    l_current_pi->ty0 = l_ty0;
 1497|  7.30k|    l_current_pi->tx1 = l_tx1;
 1498|  7.30k|    l_current_pi->ty1 = l_ty1;
 1499|       |
 1500|       |    /*l_current_pi->dx = l_img_comp->dx;*/
 1501|       |    /*l_current_pi->dy = l_img_comp->dy;*/
 1502|       |
 1503|  7.30k|    l_current_pi->step_p = l_step_p;
 1504|  7.30k|    l_current_pi->step_c = l_step_c;
 1505|  7.30k|    l_current_pi->step_r = l_step_r;
 1506|  7.30k|    l_current_pi->step_l = l_step_l;
 1507|       |
 1508|       |    /* allocation for components and number of components has already been calculated by opj_pi_create */
 1509|  7.30k|    for
 1510|  31.0k|    (compno = 0; compno < numcomps; ++compno) {
  ------------------
  |  Branch (1510:18): [True: 23.7k, False: 7.30k]
  ------------------
 1511|  23.7k|        opj_pi_resolution_t *l_res = l_current_comp->resolutions;
 1512|  23.7k|        l_encoding_value_ptr = l_tmp_ptr[compno];
 1513|       |
 1514|  23.7k|        l_current_comp->dx = l_img_comp->dx;
 1515|  23.7k|        l_current_comp->dy = l_img_comp->dy;
 1516|       |        /* resolutions have already been initialized */
 1517|  23.7k|        for
 1518|   227k|        (resno = 0; resno < l_current_comp->numresolutions; resno++) {
  ------------------
  |  Branch (1518:21): [True: 203k, False: 23.7k]
  ------------------
 1519|   203k|            l_res->pdx = *(l_encoding_value_ptr++);
 1520|   203k|            l_res->pdy = *(l_encoding_value_ptr++);
 1521|   203k|            l_res->pw =  *(l_encoding_value_ptr++);
 1522|   203k|            l_res->ph =  *(l_encoding_value_ptr++);
 1523|   203k|            ++l_res;
 1524|   203k|        }
 1525|  23.7k|        ++l_current_comp;
 1526|  23.7k|        ++l_img_comp;
 1527|  23.7k|        ++l_tccp;
 1528|  23.7k|    }
 1529|  7.30k|    ++l_current_pi;
 1530|       |
 1531|  15.7k|    for (pino = 1 ; pino < l_bound ; ++pino) {
  ------------------
  |  Branch (1531:21): [True: 8.41k, False: 7.30k]
  ------------------
 1532|  8.41k|        l_current_comp = l_current_pi->comps;
 1533|  8.41k|        l_img_comp = p_image->comps;
 1534|  8.41k|        l_tccp = l_tcp->tccps;
 1535|       |
 1536|  8.41k|        l_current_pi->tx0 = l_tx0;
 1537|  8.41k|        l_current_pi->ty0 = l_ty0;
 1538|  8.41k|        l_current_pi->tx1 = l_tx1;
 1539|  8.41k|        l_current_pi->ty1 = l_ty1;
 1540|       |        /*l_current_pi->dx = l_dx_min;*/
 1541|       |        /*l_current_pi->dy = l_dy_min;*/
 1542|  8.41k|        l_current_pi->step_p = l_step_p;
 1543|  8.41k|        l_current_pi->step_c = l_step_c;
 1544|  8.41k|        l_current_pi->step_r = l_step_r;
 1545|  8.41k|        l_current_pi->step_l = l_step_l;
 1546|       |
 1547|       |        /* allocation for components and number of components has already been calculated by opj_pi_create */
 1548|  8.41k|        for
 1549|  45.5k|        (compno = 0; compno < numcomps; ++compno) {
  ------------------
  |  Branch (1549:22): [True: 37.1k, False: 8.41k]
  ------------------
 1550|  37.1k|            opj_pi_resolution_t *l_res = l_current_comp->resolutions;
 1551|  37.1k|            l_encoding_value_ptr = l_tmp_ptr[compno];
 1552|       |
 1553|  37.1k|            l_current_comp->dx = l_img_comp->dx;
 1554|  37.1k|            l_current_comp->dy = l_img_comp->dy;
 1555|       |            /* resolutions have already been initialized */
 1556|  37.1k|            for
 1557|   296k|            (resno = 0; resno < l_current_comp->numresolutions; resno++) {
  ------------------
  |  Branch (1557:25): [True: 259k, False: 37.1k]
  ------------------
 1558|   259k|                l_res->pdx = *(l_encoding_value_ptr++);
 1559|   259k|                l_res->pdy = *(l_encoding_value_ptr++);
 1560|   259k|                l_res->pw =  *(l_encoding_value_ptr++);
 1561|   259k|                l_res->ph =  *(l_encoding_value_ptr++);
 1562|   259k|                ++l_res;
 1563|   259k|            }
 1564|  37.1k|            ++l_current_comp;
 1565|  37.1k|            ++l_img_comp;
 1566|  37.1k|            ++l_tccp;
 1567|  37.1k|        }
 1568|       |        /* special treatment*/
 1569|  8.41k|        l_current_pi->include = (l_current_pi - 1)->include;
 1570|  8.41k|        l_current_pi->include_size = (l_current_pi - 1)->include_size;
 1571|  8.41k|        ++l_current_pi;
 1572|  8.41k|    }
 1573|  7.30k|    opj_free(l_tmp_data);
 1574|  7.30k|    l_tmp_data = 00;
 1575|  7.30k|    opj_free(l_tmp_ptr);
 1576|  7.30k|    l_tmp_ptr = 00;
 1577|  7.30k|    if
 1578|  7.30k|    (l_tcp->POC) {
  ------------------
  |  Branch (1578:6): [True: 572, False: 6.73k]
  ------------------
 1579|    572|        opj_pi_update_decode_poc(l_pi, l_tcp, l_max_prec, l_max_res);
 1580|  6.73k|    } else {
 1581|  6.73k|        opj_pi_update_decode_not_poc(l_pi, l_tcp, l_max_prec, l_max_res);
 1582|  6.73k|    }
 1583|  7.30k|    return l_pi;
 1584|  7.31k|}
opj_pi_destroy:
 2068|  7.31k|{
 2069|  7.31k|    OPJ_UINT32 compno, pino;
 2070|  7.31k|    opj_pi_iterator_t *l_current_pi = p_pi;
 2071|  7.31k|    if (p_pi) {
  ------------------
  |  Branch (2071:9): [True: 7.31k, False: 0]
  ------------------
 2072|  7.31k|        if (p_pi->include) {
  ------------------
  |  Branch (2072:13): [True: 7.30k, False: 9]
  ------------------
 2073|  7.30k|            opj_free(p_pi->include);
 2074|  7.30k|            p_pi->include = 00;
 2075|  7.30k|        }
 2076|  23.0k|        for (pino = 0; pino < p_nb_elements; ++pino) {
  ------------------
  |  Branch (2076:24): [True: 15.7k, False: 7.31k]
  ------------------
 2077|  15.7k|            if (l_current_pi->comps) {
  ------------------
  |  Branch (2077:17): [True: 15.7k, False: 0]
  ------------------
 2078|  15.7k|                opj_pi_comp_t *l_current_component = l_current_pi->comps;
 2079|  76.9k|                for (compno = 0; compno < l_current_pi->numcomps; compno++) {
  ------------------
  |  Branch (2079:34): [True: 61.1k, False: 15.7k]
  ------------------
 2080|  61.1k|                    if (l_current_component->resolutions) {
  ------------------
  |  Branch (2080:25): [True: 61.1k, False: 0]
  ------------------
 2081|  61.1k|                        opj_free(l_current_component->resolutions);
 2082|  61.1k|                        l_current_component->resolutions = 00;
 2083|  61.1k|                    }
 2084|       |
 2085|  61.1k|                    ++l_current_component;
 2086|  61.1k|                }
 2087|  15.7k|                opj_free(l_current_pi->comps);
 2088|  15.7k|                l_current_pi->comps = 0;
 2089|  15.7k|            }
 2090|  15.7k|            ++l_current_pi;
 2091|  15.7k|        }
 2092|  7.31k|        opj_free(p_pi);
 2093|  7.31k|    }
 2094|  7.31k|}
opj_pi_next:
 2132|  33.1M|{
 2133|  33.1M|    switch (pi->poc.prg) {
  ------------------
  |  Branch (2133:13): [True: 3.62k, False: 33.1M]
  ------------------
 2134|  3.25M|    case OPJ_LRCP:
  ------------------
  |  Branch (2134:5): [True: 3.25M, False: 29.9M]
  ------------------
 2135|  3.25M|        return opj_pi_next_lrcp(pi);
 2136|  7.33M|    case OPJ_RLCP:
  ------------------
  |  Branch (2136:5): [True: 7.33M, False: 25.8M]
  ------------------
 2137|  7.33M|        return opj_pi_next_rlcp(pi);
 2138|  8.26M|    case OPJ_RPCL:
  ------------------
  |  Branch (2138:5): [True: 8.26M, False: 24.8M]
  ------------------
 2139|  8.26M|        return opj_pi_next_rpcl(pi);
 2140|  10.4M|    case OPJ_PCRL:
  ------------------
  |  Branch (2140:5): [True: 10.4M, False: 22.7M]
  ------------------
 2141|  10.4M|        return opj_pi_next_pcrl(pi);
 2142|  3.84M|    case OPJ_CPRL:
  ------------------
  |  Branch (2142:5): [True: 3.84M, False: 29.3M]
  ------------------
 2143|  3.84M|        return opj_pi_next_cprl(pi);
 2144|      0|    case OPJ_PROG_UNKNOWN:
  ------------------
  |  Branch (2144:5): [True: 0, False: 33.1M]
  ------------------
 2145|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2146|  33.1M|    }
 2147|       |
 2148|  3.62k|    return OPJ_FALSE;
  ------------------
  |  |  118|  3.62k|#define OPJ_FALSE 0
  ------------------
 2149|  33.1M|}
pi.c:opj_pi_create:
 1018|  7.31k|{
 1019|       |    /* loop*/
 1020|  7.31k|    OPJ_UINT32 pino, compno;
 1021|       |    /* number of poc in the p_pi*/
 1022|  7.31k|    OPJ_UINT32 l_poc_bound;
 1023|       |
 1024|       |    /* pointers to tile coding parameters and components.*/
 1025|  7.31k|    opj_pi_iterator_t *l_pi = 00;
 1026|  7.31k|    opj_tcp_t *tcp = 00;
 1027|  7.31k|    const opj_tccp_t *tccp = 00;
 1028|       |
 1029|       |    /* current packet iterator being allocated*/
 1030|  7.31k|    opj_pi_iterator_t *l_current_pi = 00;
 1031|       |
 1032|       |    /* preconditions in debug*/
 1033|  7.31k|    assert(cp != 00);
 1034|  7.31k|    assert(image != 00);
 1035|  7.31k|    assert(tileno < cp->tw * cp->th);
 1036|       |
 1037|       |    /* initializations*/
 1038|  7.31k|    tcp = &cp->tcps[tileno];
 1039|  7.31k|    l_poc_bound = tcp->numpocs + 1;
 1040|       |
 1041|       |    /* memory allocations*/
 1042|  7.31k|    l_pi = (opj_pi_iterator_t*) opj_calloc((l_poc_bound),
 1043|  7.31k|                                           sizeof(opj_pi_iterator_t));
 1044|  7.31k|    if (!l_pi) {
  ------------------
  |  Branch (1044:9): [True: 0, False: 7.31k]
  ------------------
 1045|      0|        return NULL;
 1046|      0|    }
 1047|       |
 1048|  7.31k|    l_current_pi = l_pi;
 1049|  23.0k|    for (pino = 0; pino < l_poc_bound ; ++pino) {
  ------------------
  |  Branch (1049:20): [True: 15.7k, False: 7.31k]
  ------------------
 1050|       |
 1051|  15.7k|        l_current_pi->manager = manager;
 1052|       |
 1053|  15.7k|        l_current_pi->comps = (opj_pi_comp_t*) opj_calloc(image->numcomps,
 1054|  15.7k|                              sizeof(opj_pi_comp_t));
 1055|  15.7k|        if (! l_current_pi->comps) {
  ------------------
  |  Branch (1055:13): [True: 0, False: 15.7k]
  ------------------
 1056|      0|            opj_pi_destroy(l_pi, l_poc_bound);
 1057|      0|            return NULL;
 1058|      0|        }
 1059|       |
 1060|  15.7k|        l_current_pi->numcomps = image->numcomps;
 1061|       |
 1062|  76.9k|        for (compno = 0; compno < image->numcomps; ++compno) {
  ------------------
  |  Branch (1062:26): [True: 61.1k, False: 15.7k]
  ------------------
 1063|  61.1k|            opj_pi_comp_t *comp = &l_current_pi->comps[compno];
 1064|       |
 1065|  61.1k|            tccp = &tcp->tccps[compno];
 1066|       |
 1067|  61.1k|            comp->resolutions = (opj_pi_resolution_t*) opj_calloc(tccp->numresolutions,
 1068|  61.1k|                                sizeof(opj_pi_resolution_t));
 1069|  61.1k|            if (!comp->resolutions) {
  ------------------
  |  Branch (1069:17): [True: 0, False: 61.1k]
  ------------------
 1070|      0|                opj_pi_destroy(l_pi, l_poc_bound);
 1071|      0|                return 00;
 1072|      0|            }
 1073|       |
 1074|  61.1k|            comp->numresolutions = tccp->numresolutions;
 1075|  61.1k|        }
 1076|  15.7k|        ++l_current_pi;
 1077|  15.7k|    }
 1078|  7.31k|    return l_pi;
 1079|  7.31k|}
pi.c:opj_get_all_encoding_parameters:
  890|  7.31k|{
  891|       |    /* loop*/
  892|  7.31k|    OPJ_UINT32 compno, resno;
  893|       |
  894|       |    /* pointers*/
  895|  7.31k|    const opj_tcp_t *tcp = 00;
  896|  7.31k|    const opj_tccp_t * l_tccp = 00;
  897|  7.31k|    const opj_image_comp_t * l_img_comp = 00;
  898|       |
  899|       |    /* to store l_dx, l_dy, w and h for each resolution and component.*/
  900|  7.31k|    OPJ_UINT32 * lResolutionPtr;
  901|       |
  902|       |    /* position in x and y of tile*/
  903|  7.31k|    OPJ_UINT32 p, q;
  904|       |
  905|       |    /* non-corrected (in regard to image offset) tile offset */
  906|  7.31k|    OPJ_UINT32 l_tx0, l_ty0;
  907|       |
  908|       |    /* preconditions in debug*/
  909|  7.31k|    assert(p_cp != 00);
  910|  7.31k|    assert(p_image != 00);
  911|  7.31k|    assert(tileno < p_cp->tw * p_cp->th);
  912|       |
  913|       |    /* initializations*/
  914|  7.31k|    tcp = &p_cp->tcps [tileno];
  915|  7.31k|    l_tccp = tcp->tccps;
  916|  7.31k|    l_img_comp = p_image->comps;
  917|       |
  918|       |    /* position in x and y of tile*/
  919|  7.31k|    p = tileno % p_cp->tw;
  920|  7.31k|    q = tileno / p_cp->tw;
  921|       |
  922|       |    /* here calculation of tx0, tx1, ty0, ty1, maxprec, l_dx and l_dy */
  923|  7.31k|    l_tx0 = p_cp->tx0 + p *
  924|  7.31k|            p_cp->tdx; /* can't be greater than p_image->x1 so won't overflow */
  925|  7.31k|    *p_tx0 = opj_uint_max(l_tx0, p_image->x0);
  926|  7.31k|    *p_tx1 = opj_uint_min(opj_uint_adds(l_tx0, p_cp->tdx), p_image->x1);
  927|  7.31k|    l_ty0 = p_cp->ty0 + q *
  928|  7.31k|            p_cp->tdy; /* can't be greater than p_image->y1 so won't overflow */
  929|  7.31k|    *p_ty0 = opj_uint_max(l_ty0, p_image->y0);
  930|  7.31k|    *p_ty1 = opj_uint_min(opj_uint_adds(l_ty0, p_cp->tdy), p_image->y1);
  931|       |
  932|       |    /* max precision and resolution is 0 (can only grow)*/
  933|  7.31k|    *p_max_prec = 0;
  934|  7.31k|    *p_max_res = 0;
  935|       |
  936|       |    /* take the largest value for dx_min and dy_min*/
  937|  7.31k|    *p_dx_min = 0x7fffffff;
  938|  7.31k|    *p_dy_min = 0x7fffffff;
  939|       |
  940|  31.0k|    for (compno = 0; compno < p_image->numcomps; ++compno) {
  ------------------
  |  Branch (940:22): [True: 23.7k, False: 7.31k]
  ------------------
  941|       |        /* arithmetic variables to calculate*/
  942|  23.7k|        OPJ_UINT32 l_level_no;
  943|  23.7k|        OPJ_UINT32 l_rx0, l_ry0, l_rx1, l_ry1;
  944|  23.7k|        OPJ_UINT32 l_px0, l_py0, l_px1, py1;
  945|  23.7k|        OPJ_UINT32 l_product;
  946|  23.7k|        OPJ_UINT32 l_tcx0, l_tcy0, l_tcx1, l_tcy1;
  947|  23.7k|        OPJ_UINT32 l_pdx, l_pdy, l_pw, l_ph;
  948|       |
  949|  23.7k|        lResolutionPtr = p_resolutions ? p_resolutions[compno] : NULL;
  ------------------
  |  Branch (949:26): [True: 23.7k, False: 0]
  ------------------
  950|       |
  951|  23.7k|        l_tcx0 = opj_uint_ceildiv(*p_tx0, l_img_comp->dx);
  952|  23.7k|        l_tcy0 = opj_uint_ceildiv(*p_ty0, l_img_comp->dy);
  953|  23.7k|        l_tcx1 = opj_uint_ceildiv(*p_tx1, l_img_comp->dx);
  954|  23.7k|        l_tcy1 = opj_uint_ceildiv(*p_ty1, l_img_comp->dy);
  955|       |
  956|  23.7k|        if (l_tccp->numresolutions > *p_max_res) {
  ------------------
  |  Branch (956:13): [True: 7.33k, False: 16.4k]
  ------------------
  957|  7.33k|            *p_max_res = l_tccp->numresolutions;
  958|  7.33k|        }
  959|       |
  960|       |        /* use custom size for precincts*/
  961|  23.7k|        l_level_no = l_tccp->numresolutions;
  962|   227k|        for (resno = 0; resno < l_tccp->numresolutions; ++resno) {
  ------------------
  |  Branch (962:25): [True: 203k, False: 23.7k]
  ------------------
  963|   203k|            OPJ_UINT32 l_dx, l_dy;
  964|       |
  965|   203k|            --l_level_no;
  966|       |
  967|       |            /* precinct width and height*/
  968|   203k|            l_pdx = l_tccp->prcw[resno];
  969|   203k|            l_pdy = l_tccp->prch[resno];
  970|   203k|            if (lResolutionPtr) {
  ------------------
  |  Branch (970:17): [True: 203k, False: 0]
  ------------------
  971|   203k|                *lResolutionPtr++ = l_pdx;
  972|   203k|                *lResolutionPtr++ = l_pdy;
  973|   203k|            }
  974|   203k|            if (l_pdx + l_level_no < 32 &&
  ------------------
  |  Branch (974:17): [True: 154k, False: 49.7k]
  ------------------
  975|   203k|                    l_img_comp->dx <= UINT_MAX / (1u << (l_pdx + l_level_no))) {
  ------------------
  |  Branch (975:21): [True: 141k, False: 12.4k]
  ------------------
  976|   141k|                l_dx = l_img_comp->dx * (1u << (l_pdx + l_level_no));
  977|       |                /* take the minimum size for l_dx for each comp and resolution*/
  978|   141k|                *p_dx_min = opj_uint_min(*p_dx_min, l_dx);
  979|   141k|            }
  980|   203k|            if (l_pdy + l_level_no < 32 &&
  ------------------
  |  Branch (980:17): [True: 154k, False: 49.7k]
  ------------------
  981|   203k|                    l_img_comp->dy <= UINT_MAX / (1u << (l_pdy + l_level_no))) {
  ------------------
  |  Branch (981:21): [True: 141k, False: 12.7k]
  ------------------
  982|   141k|                l_dy = l_img_comp->dy * (1u << (l_pdy + l_level_no));
  983|   141k|                *p_dy_min = opj_uint_min(*p_dy_min, l_dy);
  984|   141k|            }
  985|       |
  986|       |            /* various calculations of extents*/
  987|   203k|            l_rx0 = opj_uint_ceildivpow2(l_tcx0, l_level_no);
  988|   203k|            l_ry0 = opj_uint_ceildivpow2(l_tcy0, l_level_no);
  989|   203k|            l_rx1 = opj_uint_ceildivpow2(l_tcx1, l_level_no);
  990|   203k|            l_ry1 = opj_uint_ceildivpow2(l_tcy1, l_level_no);
  991|   203k|            l_px0 = opj_uint_floordivpow2(l_rx0, l_pdx) << l_pdx;
  992|   203k|            l_py0 = opj_uint_floordivpow2(l_ry0, l_pdy) << l_pdy;
  993|   203k|            l_px1 = opj_uint_ceildivpow2(l_rx1, l_pdx) << l_pdx;
  994|   203k|            py1 = opj_uint_ceildivpow2(l_ry1, l_pdy) << l_pdy;
  995|   203k|            l_pw = (l_rx0 == l_rx1) ? 0 : ((l_px1 - l_px0) >> l_pdx);
  ------------------
  |  Branch (995:20): [True: 120k, False: 83.6k]
  ------------------
  996|   203k|            l_ph = (l_ry0 == l_ry1) ? 0 : ((py1 - l_py0) >> l_pdy);
  ------------------
  |  Branch (996:20): [True: 104k, False: 99.8k]
  ------------------
  997|   203k|            if (lResolutionPtr) {
  ------------------
  |  Branch (997:17): [True: 203k, False: 0]
  ------------------
  998|   203k|                *lResolutionPtr++ = l_pw;
  999|   203k|                *lResolutionPtr++ = l_ph;
 1000|   203k|            }
 1001|   203k|            l_product = l_pw * l_ph;
 1002|       |
 1003|       |            /* update precision*/
 1004|   203k|            if (l_product > *p_max_prec) {
  ------------------
  |  Branch (1004:17): [True: 8.83k, False: 195k]
  ------------------
 1005|  8.83k|                *p_max_prec = l_product;
 1006|  8.83k|            }
 1007|       |
 1008|   203k|        }
 1009|  23.7k|        ++l_tccp;
 1010|  23.7k|        ++l_img_comp;
 1011|  23.7k|    }
 1012|  7.31k|}
pi.c:opj_pi_update_decode_poc:
 1219|    572|{
 1220|       |    /* loop*/
 1221|    572|    OPJ_UINT32 pino;
 1222|       |
 1223|       |    /* encoding parameters to set*/
 1224|    572|    OPJ_UINT32 l_bound;
 1225|       |
 1226|    572|    opj_pi_iterator_t * l_current_pi = 00;
 1227|    572|    opj_poc_t* l_current_poc = 0;
 1228|       |
 1229|    572|    OPJ_ARG_NOT_USED(p_max_res);
  ------------------
  |  |  144|    572|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1230|       |
 1231|       |    /* preconditions in debug*/
 1232|    572|    assert(p_pi != 00);
 1233|    572|    assert(p_tcp != 00);
 1234|       |
 1235|       |    /* initializations*/
 1236|    572|    l_bound = p_tcp->numpocs + 1;
 1237|    572|    l_current_pi = p_pi;
 1238|    572|    l_current_poc = p_tcp->pocs;
 1239|       |
 1240|  9.56k|    for (pino = 0; pino < l_bound; ++pino) {
  ------------------
  |  Branch (1240:20): [True: 8.98k, False: 572]
  ------------------
 1241|  8.98k|        l_current_pi->poc.prg = l_current_poc->prg; /* Progression Order #0 */
 1242|  8.98k|        l_current_pi->first = 1;
 1243|       |
 1244|  8.98k|        l_current_pi->poc.resno0 =
 1245|  8.98k|            l_current_poc->resno0; /* Resolution Level Index #0 (Start) */
 1246|  8.98k|        l_current_pi->poc.compno0 =
 1247|  8.98k|            l_current_poc->compno0; /* Component Index #0 (Start) */
 1248|  8.98k|        l_current_pi->poc.layno0 = 0;
 1249|  8.98k|        l_current_pi->poc.precno0 = 0;
 1250|  8.98k|        l_current_pi->poc.resno1 =
 1251|  8.98k|            l_current_poc->resno1; /* Resolution Level Index #0 (End) */
 1252|  8.98k|        l_current_pi->poc.compno1 =
 1253|  8.98k|            l_current_poc->compno1; /* Component Index #0 (End) */
 1254|  8.98k|        l_current_pi->poc.layno1 = opj_uint_min(l_current_poc->layno1,
 1255|  8.98k|                                                p_tcp->numlayers); /* Layer Index #0 (End) */
 1256|  8.98k|        l_current_pi->poc.precno1 = p_max_precision;
 1257|  8.98k|        ++l_current_pi;
 1258|  8.98k|        ++l_current_poc;
 1259|  8.98k|    }
 1260|    572|}
pi.c:opj_pi_update_decode_not_poc:
 1266|  6.73k|{
 1267|       |    /* loop*/
 1268|  6.73k|    OPJ_UINT32 pino;
 1269|       |
 1270|       |    /* encoding parameters to set*/
 1271|  6.73k|    OPJ_UINT32 l_bound;
 1272|       |
 1273|  6.73k|    opj_pi_iterator_t * l_current_pi = 00;
 1274|       |    /* preconditions in debug*/
 1275|  6.73k|    assert(p_tcp != 00);
 1276|  6.73k|    assert(p_pi != 00);
 1277|       |
 1278|       |    /* initializations*/
 1279|  6.73k|    l_bound = p_tcp->numpocs + 1;
 1280|  6.73k|    l_current_pi = p_pi;
 1281|       |
 1282|  13.4k|    for (pino = 0; pino < l_bound; ++pino) {
  ------------------
  |  Branch (1282:20): [True: 6.73k, False: 6.73k]
  ------------------
 1283|  6.73k|        l_current_pi->poc.prg = p_tcp->prg;
 1284|  6.73k|        l_current_pi->first = 1;
 1285|  6.73k|        l_current_pi->poc.resno0 = 0;
 1286|  6.73k|        l_current_pi->poc.compno0 = 0;
 1287|  6.73k|        l_current_pi->poc.layno0 = 0;
 1288|  6.73k|        l_current_pi->poc.precno0 = 0;
 1289|  6.73k|        l_current_pi->poc.resno1 = p_max_res;
 1290|  6.73k|        l_current_pi->poc.compno1 = l_current_pi->numcomps;
 1291|  6.73k|        l_current_pi->poc.layno1 = p_tcp->numlayers;
 1292|  6.73k|        l_current_pi->poc.precno1 = p_max_precision;
 1293|  6.73k|        ++l_current_pi;
 1294|  6.73k|    }
 1295|  6.73k|}
pi.c:opj_pi_next_lrcp:
  238|  3.25M|{
  239|  3.25M|    opj_pi_comp_t *comp = NULL;
  240|  3.25M|    opj_pi_resolution_t *res = NULL;
  241|  3.25M|    OPJ_UINT32 index = 0;
  242|       |
  243|  3.25M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (243:9): [True: 947, False: 3.25M]
  ------------------
  244|  3.25M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (244:13): [True: 0, False: 3.25M]
  ------------------
  245|    947|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|    947|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  246|    947|                      "opj_pi_next_lrcp(): invalid compno0/compno1\n");
  247|    947|        return OPJ_FALSE;
  ------------------
  |  |  118|    947|#define OPJ_FALSE 0
  ------------------
  248|    947|    }
  249|       |
  250|  3.25M|    if (!pi->first) {
  ------------------
  |  Branch (250:9): [True: 3.24M, False: 3.99k]
  ------------------
  251|  3.24M|        comp = &pi->comps[pi->compno];
  252|  3.24M|        res = &comp->resolutions[pi->resno];
  253|  3.24M|        goto LABEL_SKIP;
  254|  3.24M|    } else {
  255|  3.99k|        pi->first = 0;
  256|  3.99k|    }
  257|       |
  258|   419k|    for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (258:38): [True: 418k, False: 930]
  ------------------
  259|  2.62M|        for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1;
  ------------------
  |  Branch (259:42): [True: 2.21M, False: 415k]
  ------------------
  260|  2.21M|                pi->resno++) {
  261|  4.55M|            for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (261:48): [True: 2.34M, False: 2.21M]
  ------------------
  262|  2.34M|                comp = &pi->comps[pi->compno];
  263|  2.34M|                if (pi->resno >= comp->numresolutions) {
  ------------------
  |  Branch (263:21): [True: 703k, False: 1.64M]
  ------------------
  264|   703k|                    continue;
  265|   703k|                }
  266|  1.64M|                res = &comp->resolutions[pi->resno];
  267|  1.64M|                if (!pi->tp_on) {
  ------------------
  |  Branch (267:21): [True: 1.64M, False: 0]
  ------------------
  268|  1.64M|                    pi->poc.precno1 = res->pw * res->ph;
  269|  1.64M|                }
  270|  4.89M|                for (pi->precno = pi->poc.precno0; pi->precno < pi->poc.precno1; pi->precno++) {
  ------------------
  |  Branch (270:52): [True: 3.25M, False: 1.64M]
  ------------------
  271|  3.25M|                    index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  272|  3.25M|                            pi->step_c + pi->precno * pi->step_p;
  273|       |                    /* Avoids index out of bounds access with */
  274|       |                    /* id_000098,sig_11,src_005411,op_havoc,rep_2 of */
  275|       |                    /* https://github.com/uclouvain/openjpeg/issues/938 */
  276|       |                    /* Not sure if this is the most clever fix. Perhaps */
  277|       |                    /* include should be resized when a POC arises, or */
  278|       |                    /* the POC should be rejected */
  279|  3.25M|                    if (index >= pi->include_size) {
  ------------------
  |  Branch (279:25): [True: 0, False: 3.25M]
  ------------------
  280|      0|                        opj_event_msg(pi->manager, EVT_ERROR, "Invalid access to pi->include");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  281|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  282|      0|                    }
  283|  3.25M|                    if (!pi->include[index]) {
  ------------------
  |  Branch (283:25): [True: 3.25M, False: 48]
  ------------------
  284|  3.25M|                        pi->include[index] = 1;
  285|  3.25M|                        return OPJ_TRUE;
  ------------------
  |  |  117|  3.25M|#define OPJ_TRUE 1
  ------------------
  286|  3.25M|                    }
  287|  3.24M|LABEL_SKIP:
  288|  3.24M|                    ;
  289|  3.24M|                }
  290|  1.64M|            }
  291|  2.21M|        }
  292|   418k|    }
  293|       |
  294|    930|    return OPJ_FALSE;
  ------------------
  |  |  118|    930|#define OPJ_FALSE 0
  ------------------
  295|  3.99k|}
pi.c:opj_pi_next_rlcp:
  298|  7.33M|{
  299|  7.33M|    opj_pi_comp_t *comp = NULL;
  300|  7.33M|    opj_pi_resolution_t *res = NULL;
  301|  7.33M|    OPJ_UINT32 index = 0;
  302|       |
  303|  7.33M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (303:9): [True: 127, False: 7.33M]
  ------------------
  304|  7.33M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (304:13): [True: 0, False: 7.33M]
  ------------------
  305|    127|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|    127|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  306|    127|                      "opj_pi_next_rlcp(): invalid compno0/compno1\n");
  307|    127|        return OPJ_FALSE;
  ------------------
  |  |  118|    127|#define OPJ_FALSE 0
  ------------------
  308|    127|    }
  309|       |
  310|  7.33M|    if (!pi->first) {
  ------------------
  |  Branch (310:9): [True: 7.33M, False: 2.37k]
  ------------------
  311|  7.33M|        comp = &pi->comps[pi->compno];
  312|  7.33M|        res = &comp->resolutions[pi->resno];
  313|  7.33M|        goto LABEL_SKIP;
  314|  7.33M|    } else {
  315|  2.37k|        pi->first = 0;
  316|  2.37k|    }
  317|       |
  318|  10.6k|    for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
  ------------------
  |  Branch (318:38): [True: 9.07k, False: 1.55k]
  ------------------
  319|  1.13M|        for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (319:42): [True: 1.12M, False: 8.26k]
  ------------------
  320|  7.49M|            for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (320:48): [True: 6.36M, False: 1.12M]
  ------------------
  321|  6.36M|                comp = &pi->comps[pi->compno];
  322|  6.36M|                if (pi->resno >= comp->numresolutions) {
  ------------------
  |  Branch (322:21): [True: 13.4k, False: 6.35M]
  ------------------
  323|  13.4k|                    continue;
  324|  13.4k|                }
  325|  6.35M|                res = &comp->resolutions[pi->resno];
  326|  6.35M|                if (!pi->tp_on) {
  ------------------
  |  Branch (326:21): [True: 6.35M, False: 0]
  ------------------
  327|  6.35M|                    pi->poc.precno1 = res->pw * res->ph;
  328|  6.35M|                }
  329|  13.6M|                for (pi->precno = pi->poc.precno0; pi->precno < pi->poc.precno1; pi->precno++) {
  ------------------
  |  Branch (329:52): [True: 7.33M, False: 6.35M]
  ------------------
  330|  7.33M|                    index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  331|  7.33M|                            pi->step_c + pi->precno * pi->step_p;
  332|  7.33M|                    if (index >= pi->include_size) {
  ------------------
  |  Branch (332:25): [True: 0, False: 7.33M]
  ------------------
  333|      0|                        opj_event_msg(pi->manager, EVT_ERROR, "Invalid access to pi->include");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  334|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  335|      0|                    }
  336|  7.33M|                    if (!pi->include[index]) {
  ------------------
  |  Branch (336:25): [True: 7.33M, False: 8]
  ------------------
  337|  7.33M|                        pi->include[index] = 1;
  338|  7.33M|                        return OPJ_TRUE;
  ------------------
  |  |  117|  7.33M|#define OPJ_TRUE 1
  ------------------
  339|  7.33M|                    }
  340|  7.33M|LABEL_SKIP:
  341|  7.33M|                    ;
  342|  7.33M|                }
  343|  6.35M|            }
  344|  1.12M|        }
  345|  9.07k|    }
  346|       |
  347|  1.55k|    return OPJ_FALSE;
  ------------------
  |  |  118|  1.55k|#define OPJ_FALSE 0
  ------------------
  348|  2.37k|}
pi.c:opj_pi_next_rpcl:
  351|  8.26M|{
  352|  8.26M|    opj_pi_comp_t *comp = NULL;
  353|  8.26M|    opj_pi_resolution_t *res = NULL;
  354|  8.26M|    OPJ_UINT32 index = 0;
  355|       |
  356|  8.26M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (356:9): [True: 508, False: 8.26M]
  ------------------
  357|  8.26M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (357:13): [True: 0, False: 8.26M]
  ------------------
  358|    508|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|    508|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  359|    508|                      "opj_pi_next_rpcl(): invalid compno0/compno1\n");
  360|    508|        return OPJ_FALSE;
  ------------------
  |  |  118|    508|#define OPJ_FALSE 0
  ------------------
  361|    508|    }
  362|       |
  363|  8.26M|    if (!pi->first) {
  ------------------
  |  Branch (363:9): [True: 8.26M, False: 971]
  ------------------
  364|  8.26M|        goto LABEL_SKIP;
  365|  8.26M|    } else {
  366|    971|        OPJ_UINT32 compno, resno;
  367|    971|        pi->first = 0;
  368|    971|        pi->dx = 0;
  369|    971|        pi->dy = 0;
  370|  3.15k|        for (compno = 0; compno < pi->numcomps; compno++) {
  ------------------
  |  Branch (370:26): [True: 2.17k, False: 971]
  ------------------
  371|  2.17k|            comp = &pi->comps[compno];
  372|  13.1k|            for (resno = 0; resno < comp->numresolutions; resno++) {
  ------------------
  |  Branch (372:29): [True: 10.9k, False: 2.17k]
  ------------------
  373|  10.9k|                OPJ_UINT32 dx, dy;
  374|  10.9k|                res = &comp->resolutions[resno];
  375|  10.9k|                if (res->pdx + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (375:21): [True: 8.91k, False: 2.04k]
  ------------------
  376|  10.9k|                        comp->dx <= UINT_MAX / (1u << (res->pdx + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (376:25): [True: 8.45k, False: 458]
  ------------------
  377|  8.45k|                    dx = comp->dx * (1u << (res->pdx + comp->numresolutions - 1 - resno));
  378|  8.45k|                    pi->dx = !pi->dx ? dx : opj_uint_min(pi->dx, dx);
  ------------------
  |  Branch (378:30): [True: 971, False: 7.48k]
  ------------------
  379|  8.45k|                }
  380|  10.9k|                if (res->pdy + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (380:21): [True: 8.95k, False: 2.00k]
  ------------------
  381|  10.9k|                        comp->dy <= UINT_MAX / (1u << (res->pdy + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (381:25): [True: 8.35k, False: 591]
  ------------------
  382|  8.35k|                    dy = comp->dy * (1u << (res->pdy + comp->numresolutions - 1 - resno));
  383|  8.35k|                    pi->dy = !pi->dy ? dy : opj_uint_min(pi->dy, dy);
  ------------------
  |  Branch (383:30): [True: 971, False: 7.38k]
  ------------------
  384|  8.35k|                }
  385|  10.9k|            }
  386|  2.17k|        }
  387|    971|        if (pi->dx == 0 || pi->dy == 0) {
  ------------------
  |  Branch (387:13): [True: 0, False: 971]
  |  Branch (387:28): [True: 0, False: 971]
  ------------------
  388|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  389|      0|        }
  390|    971|    }
  391|    971|    if (!pi->tp_on) {
  ------------------
  |  Branch (391:9): [True: 971, False: 0]
  ------------------
  392|    971|        pi->poc.ty0 = pi->ty0;
  393|    971|        pi->poc.tx0 = pi->tx0;
  394|    971|        pi->poc.ty1 = pi->ty1;
  395|    971|        pi->poc.tx1 = pi->tx1;
  396|    971|    }
  397|  25.4k|    for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
  ------------------
  |  Branch (397:38): [True: 25.0k, False: 383]
  ------------------
  398|   771k|        for (pi->y = (OPJ_UINT32)pi->poc.ty0; pi->y < (OPJ_UINT32)pi->poc.ty1;
  ------------------
  |  Branch (398:47): [True: 746k, False: 24.4k]
  ------------------
  399|   746k|                pi->y += (pi->dy - (pi->y % pi->dy))) {
  400|  13.3M|            for (pi->x = (OPJ_UINT32)pi->poc.tx0; pi->x < (OPJ_UINT32)pi->poc.tx1;
  ------------------
  |  Branch (400:51): [True: 12.6M, False: 746k]
  ------------------
  401|  12.6M|                    pi->x += (pi->dx - (pi->x % pi->dx))) {
  402|  15.2M|                for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (402:52): [True: 2.61M, False: 12.6M]
  ------------------
  403|  2.61M|                    OPJ_UINT32 levelno;
  404|  2.61M|                    OPJ_UINT32 trx0, try0;
  405|  2.61M|                    OPJ_UINT32  trx1, try1;
  406|  2.61M|                    OPJ_UINT32  rpx, rpy;
  407|  2.61M|                    OPJ_UINT32  prci, prcj;
  408|  2.61M|                    comp = &pi->comps[pi->compno];
  409|  2.61M|                    if (pi->resno >= comp->numresolutions) {
  ------------------
  |  Branch (409:25): [True: 2.26M, False: 346k]
  ------------------
  410|  2.26M|                        continue;
  411|  2.26M|                    }
  412|   346k|                    res = &comp->resolutions[pi->resno];
  413|   346k|                    levelno = comp->numresolutions - 1 - pi->resno;
  414|       |
  415|   346k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
  ------------------
  |  Branch (415:25): [True: 0, False: 346k]
  ------------------
  416|   346k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
  ------------------
  |  Branch (416:29): [True: 0, False: 346k]
  ------------------
  417|      0|                        continue;
  418|      0|                    }
  419|       |
  420|   346k|                    trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
  421|   346k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  422|   346k|                    try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
  423|   346k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  424|   346k|                    trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
  425|   346k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  426|   346k|                    try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
  427|   346k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  428|   346k|                    rpx = res->pdx + levelno;
  429|   346k|                    rpy = res->pdy + levelno;
  430|       |
  431|   346k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
  ------------------
  |  Branch (431:25): [True: 0, False: 346k]
  ------------------
  432|   346k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
  ------------------
  |  Branch (432:29): [True: 0, False: 346k]
  ------------------
  433|      0|                        continue;
  434|      0|                    }
  435|       |
  436|       |                    /* See ISO-15441. B.12.1.3 Resolution level-position-component-layer progression */
  437|   346k|                    if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
  ------------------
  |  Branch (437:27): [True: 111k, False: 234k]
  ------------------
  438|   346k|                            ((pi->y == pi->ty0) &&
  ------------------
  |  Branch (438:30): [True: 52.9k, False: 181k]
  ------------------
  439|   234k|                             (((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
  ------------------
  |  Branch (439:30): [True: 50.6k, False: 2.22k]
  ------------------
  440|   183k|                        continue;
  441|   183k|                    }
  442|   162k|                    if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
  ------------------
  |  Branch (442:27): [True: 37.6k, False: 124k]
  ------------------
  443|   162k|                            ((pi->x == pi->tx0) &&
  ------------------
  |  Branch (443:30): [True: 12.9k, False: 111k]
  ------------------
  444|   124k|                             (((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
  ------------------
  |  Branch (444:30): [True: 12.7k, False: 268]
  ------------------
  445|   111k|                        continue;
  446|   111k|                    }
  447|       |
  448|  50.4k|                    if ((res->pw == 0) || (res->ph == 0)) {
  ------------------
  |  Branch (448:25): [True: 4.17k, False: 46.2k]
  |  Branch (448:43): [True: 3.71k, False: 42.5k]
  ------------------
  449|  7.88k|                        continue;
  450|  7.88k|                    }
  451|       |
  452|  42.5k|                    if ((trx0 == trx1) || (try0 == try1)) {
  ------------------
  |  Branch (452:25): [True: 0, False: 42.5k]
  |  Branch (452:43): [True: 0, False: 42.5k]
  ------------------
  453|      0|                        continue;
  454|      0|                    }
  455|       |
  456|  42.5k|                    prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
  457|  42.5k|                                                 ((OPJ_UINT64)comp->dx << levelno)), res->pdx)
  458|  42.5k|                           - opj_uint_floordivpow2(trx0, res->pdx);
  459|  42.5k|                    prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
  460|  42.5k|                                                 ((OPJ_UINT64)comp->dy << levelno)), res->pdy)
  461|  42.5k|                           - opj_uint_floordivpow2(try0, res->pdy);
  462|  42.5k|                    pi->precno = prci + prcj * res->pw;
  463|  8.30M|                    for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (463:54): [True: 8.26M, False: 41.9k]
  ------------------
  464|  8.26M|                        index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  465|  8.26M|                                pi->step_c + pi->precno * pi->step_p;
  466|  8.26M|                        if (index >= pi->include_size) {
  ------------------
  |  Branch (466:29): [True: 0, False: 8.26M]
  ------------------
  467|      0|                            opj_event_msg(pi->manager, EVT_ERROR, "Invalid access to pi->include");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  468|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  469|      0|                        }
  470|  8.26M|                        if (!pi->include[index]) {
  ------------------
  |  Branch (470:29): [True: 8.26M, False: 985]
  ------------------
  471|  8.26M|                            pi->include[index] = 1;
  472|  8.26M|                            return OPJ_TRUE;
  ------------------
  |  |  117|  8.26M|#define OPJ_TRUE 1
  ------------------
  473|  8.26M|                        }
  474|  8.26M|LABEL_SKIP:
  475|  8.26M|                        ;
  476|  8.26M|                    }
  477|  42.5k|                }
  478|  12.6M|            }
  479|   746k|        }
  480|  25.0k|    }
  481|       |
  482|    383|    return OPJ_FALSE;
  ------------------
  |  |  118|    383|#define OPJ_FALSE 0
  ------------------
  483|    971|}
pi.c:opj_pi_next_pcrl:
  486|  10.4M|{
  487|  10.4M|    opj_pi_comp_t *comp = NULL;
  488|  10.4M|    opj_pi_resolution_t *res = NULL;
  489|  10.4M|    OPJ_UINT32 index = 0;
  490|       |
  491|  10.4M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (491:9): [True: 768, False: 10.4M]
  ------------------
  492|  10.4M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (492:13): [True: 0, False: 10.4M]
  ------------------
  493|    768|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|    768|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  494|    768|                      "opj_pi_next_pcrl(): invalid compno0/compno1\n");
  495|    768|        return OPJ_FALSE;
  ------------------
  |  |  118|    768|#define OPJ_FALSE 0
  ------------------
  496|    768|    }
  497|       |
  498|  10.4M|    if (!pi->first) {
  ------------------
  |  Branch (498:9): [True: 10.4M, False: 718]
  ------------------
  499|  10.4M|        comp = &pi->comps[pi->compno];
  500|  10.4M|        goto LABEL_SKIP;
  501|  10.4M|    } else {
  502|    718|        OPJ_UINT32 compno, resno;
  503|    718|        pi->first = 0;
  504|    718|        pi->dx = 0;
  505|    718|        pi->dy = 0;
  506|  3.35k|        for (compno = 0; compno < pi->numcomps; compno++) {
  ------------------
  |  Branch (506:26): [True: 2.63k, False: 718]
  ------------------
  507|  2.63k|            comp = &pi->comps[compno];
  508|  20.6k|            for (resno = 0; resno < comp->numresolutions; resno++) {
  ------------------
  |  Branch (508:29): [True: 17.9k, False: 2.63k]
  ------------------
  509|  17.9k|                OPJ_UINT32 dx, dy;
  510|  17.9k|                res = &comp->resolutions[resno];
  511|  17.9k|                if (res->pdx + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (511:21): [True: 15.9k, False: 2.06k]
  ------------------
  512|  17.9k|                        comp->dx <= UINT_MAX / (1u << (res->pdx + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (512:25): [True: 14.9k, False: 937]
  ------------------
  513|  14.9k|                    dx = comp->dx * (1u << (res->pdx + comp->numresolutions - 1 - resno));
  514|  14.9k|                    pi->dx = !pi->dx ? dx : opj_uint_min(pi->dx, dx);
  ------------------
  |  Branch (514:30): [True: 718, False: 14.2k]
  ------------------
  515|  14.9k|                }
  516|  17.9k|                if (res->pdy + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (516:21): [True: 15.9k, False: 2.06k]
  ------------------
  517|  17.9k|                        comp->dy <= UINT_MAX / (1u << (res->pdy + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (517:25): [True: 14.9k, False: 994]
  ------------------
  518|  14.9k|                    dy = comp->dy * (1u << (res->pdy + comp->numresolutions - 1 - resno));
  519|  14.9k|                    pi->dy = !pi->dy ? dy : opj_uint_min(pi->dy, dy);
  ------------------
  |  Branch (519:30): [True: 718, False: 14.2k]
  ------------------
  520|  14.9k|                }
  521|  17.9k|            }
  522|  2.63k|        }
  523|    718|        if (pi->dx == 0 || pi->dy == 0) {
  ------------------
  |  Branch (523:13): [True: 0, False: 718]
  |  Branch (523:28): [True: 0, False: 718]
  ------------------
  524|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  525|      0|        }
  526|    718|    }
  527|    718|    if (!pi->tp_on) {
  ------------------
  |  Branch (527:9): [True: 718, False: 0]
  ------------------
  528|    718|        pi->poc.ty0 = pi->ty0;
  529|    718|        pi->poc.tx0 = pi->tx0;
  530|    718|        pi->poc.ty1 = pi->ty1;
  531|    718|        pi->poc.tx1 = pi->tx1;
  532|    718|    }
  533|  13.7k|    for (pi->y = (OPJ_UINT32)pi->poc.ty0; pi->y < (OPJ_UINT32)pi->poc.ty1;
  ------------------
  |  Branch (533:43): [True: 13.4k, False: 345]
  ------------------
  534|  13.4k|            pi->y += (pi->dy - (pi->y % pi->dy))) {
  535|   645k|        for (pi->x = (OPJ_UINT32)pi->poc.tx0; pi->x < (OPJ_UINT32)pi->poc.tx1;
  ------------------
  |  Branch (535:47): [True: 632k, False: 13.0k]
  ------------------
  536|   632k|                pi->x += (pi->dx - (pi->x % pi->dx))) {
  537|  2.51M|            for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (537:48): [True: 1.88M, False: 632k]
  ------------------
  538|  1.88M|                comp = &pi->comps[pi->compno];
  539|  1.88M|                for (pi->resno = pi->poc.resno0;
  540|  3.77M|                        pi->resno < opj_uint_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
  ------------------
  |  Branch (540:25): [True: 1.89M, False: 1.88M]
  ------------------
  541|  1.89M|                    OPJ_UINT32 levelno;
  542|  1.89M|                    OPJ_UINT32 trx0, try0;
  543|  1.89M|                    OPJ_UINT32 trx1, try1;
  544|  1.89M|                    OPJ_UINT32 rpx, rpy;
  545|  1.89M|                    OPJ_UINT32 prci, prcj;
  546|  1.89M|                    res = &comp->resolutions[pi->resno];
  547|  1.89M|                    levelno = comp->numresolutions - 1 - pi->resno;
  548|       |
  549|  1.89M|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
  ------------------
  |  Branch (549:25): [True: 0, False: 1.89M]
  ------------------
  550|  1.89M|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
  ------------------
  |  Branch (550:29): [True: 0, False: 1.89M]
  ------------------
  551|      0|                        continue;
  552|      0|                    }
  553|       |
  554|  1.89M|                    trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
  555|  1.89M|                                                         ((OPJ_UINT64)comp->dx << levelno));
  556|  1.89M|                    try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
  557|  1.89M|                                                         ((OPJ_UINT64)comp->dy << levelno));
  558|  1.89M|                    trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
  559|  1.89M|                                                         ((OPJ_UINT64)comp->dx << levelno));
  560|  1.89M|                    try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
  561|  1.89M|                                                         ((OPJ_UINT64)comp->dy << levelno));
  562|  1.89M|                    rpx = res->pdx + levelno;
  563|  1.89M|                    rpy = res->pdy + levelno;
  564|       |
  565|  1.89M|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
  ------------------
  |  Branch (565:25): [True: 0, False: 1.89M]
  ------------------
  566|  1.89M|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
  ------------------
  |  Branch (566:29): [True: 0, False: 1.89M]
  ------------------
  567|      0|                        continue;
  568|      0|                    }
  569|       |
  570|       |                    /* See ISO-15441. B.12.1.4 Position-component-resolution level-layer progression */
  571|  1.89M|                    if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
  ------------------
  |  Branch (571:27): [True: 639k, False: 1.25M]
  ------------------
  572|  1.89M|                            ((pi->y == pi->ty0) &&
  ------------------
  |  Branch (572:30): [True: 9.52k, False: 1.24M]
  ------------------
  573|  1.25M|                             (((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
  ------------------
  |  Branch (573:30): [True: 8.96k, False: 559]
  ------------------
  574|  1.24M|                        continue;
  575|  1.24M|                    }
  576|   648k|                    if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
  ------------------
  |  Branch (576:27): [True: 44.8k, False: 603k]
  ------------------
  577|   648k|                            ((pi->x == pi->tx0) &&
  ------------------
  |  Branch (577:30): [True: 9.86k, False: 593k]
  ------------------
  578|   603k|                             (((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
  ------------------
  |  Branch (578:30): [True: 7.11k, False: 2.75k]
  ------------------
  579|   596k|                        continue;
  580|   596k|                    }
  581|       |
  582|  51.9k|                    if ((res->pw == 0) || (res->ph == 0)) {
  ------------------
  |  Branch (582:25): [True: 1.56k, False: 50.3k]
  |  Branch (582:43): [True: 1.41k, False: 48.9k]
  ------------------
  583|  2.98k|                        continue;
  584|  2.98k|                    }
  585|       |
  586|  48.9k|                    if ((trx0 == trx1) || (try0 == try1)) {
  ------------------
  |  Branch (586:25): [True: 0, False: 48.9k]
  |  Branch (586:43): [True: 0, False: 48.9k]
  ------------------
  587|      0|                        continue;
  588|      0|                    }
  589|       |
  590|  48.9k|                    prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
  591|  48.9k|                                                 ((OPJ_UINT64)comp->dx << levelno)), res->pdx)
  592|  48.9k|                           - opj_uint_floordivpow2(trx0, res->pdx);
  593|  48.9k|                    prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
  594|  48.9k|                                                 ((OPJ_UINT64)comp->dy << levelno)), res->pdy)
  595|  48.9k|                           - opj_uint_floordivpow2(try0, res->pdy);
  596|  48.9k|                    pi->precno = prci + prcj * res->pw;
  597|  10.5M|                    for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (597:54): [True: 10.4M, False: 48.5k]
  ------------------
  598|  10.4M|                        index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  599|  10.4M|                                pi->step_c + pi->precno * pi->step_p;
  600|  10.4M|                        if (index >= pi->include_size) {
  ------------------
  |  Branch (600:29): [True: 0, False: 10.4M]
  ------------------
  601|      0|                            opj_event_msg(pi->manager, EVT_ERROR, "Invalid access to pi->include");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  602|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  603|      0|                        }
  604|  10.4M|                        if (!pi->include[index]) {
  ------------------
  |  Branch (604:29): [True: 10.4M, False: 0]
  ------------------
  605|  10.4M|                            pi->include[index] = 1;
  606|  10.4M|                            return OPJ_TRUE;
  ------------------
  |  |  117|  10.4M|#define OPJ_TRUE 1
  ------------------
  607|  10.4M|                        }
  608|  10.4M|LABEL_SKIP:
  609|  10.4M|                        ;
  610|  10.4M|                    }
  611|  48.9k|                }
  612|  1.88M|            }
  613|   632k|        }
  614|  13.4k|    }
  615|       |
  616|    345|    return OPJ_FALSE;
  ------------------
  |  |  118|    345|#define OPJ_FALSE 0
  ------------------
  617|    718|}
pi.c:opj_pi_next_cprl:
  620|  3.84M|{
  621|  3.84M|    opj_pi_comp_t *comp = NULL;
  622|  3.84M|    opj_pi_resolution_t *res = NULL;
  623|  3.84M|    OPJ_UINT32 index = 0;
  624|       |
  625|  3.84M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (625:9): [True: 74, False: 3.84M]
  ------------------
  626|  3.84M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (626:13): [True: 0, False: 3.84M]
  ------------------
  627|     74|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|     74|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  628|     74|                      "opj_pi_next_cprl(): invalid compno0/compno1\n");
  629|     74|        return OPJ_FALSE;
  ------------------
  |  |  118|     74|#define OPJ_FALSE 0
  ------------------
  630|     74|    }
  631|       |
  632|  3.84M|    if (!pi->first) {
  ------------------
  |  Branch (632:9): [True: 3.83M, False: 772]
  ------------------
  633|  3.83M|        comp = &pi->comps[pi->compno];
  634|  3.83M|        goto LABEL_SKIP;
  635|  3.83M|    } else {
  636|    772|        pi->first = 0;
  637|    772|    }
  638|       |
  639|  1.94k|    for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (639:40): [True: 1.38k, False: 561]
  ------------------
  640|  1.38k|        OPJ_UINT32 resno;
  641|  1.38k|        comp = &pi->comps[pi->compno];
  642|  1.38k|        pi->dx = 0;
  643|  1.38k|        pi->dy = 0;
  644|  12.9k|        for (resno = 0; resno < comp->numresolutions; resno++) {
  ------------------
  |  Branch (644:25): [True: 11.6k, False: 1.38k]
  ------------------
  645|  11.6k|            OPJ_UINT32 dx, dy;
  646|  11.6k|            res = &comp->resolutions[resno];
  647|  11.6k|            if (res->pdx + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (647:17): [True: 9.17k, False: 2.42k]
  ------------------
  648|  11.6k|                    comp->dx <= UINT_MAX / (1u << (res->pdx + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (648:21): [True: 8.80k, False: 375]
  ------------------
  649|  8.80k|                dx = comp->dx * (1u << (res->pdx + comp->numresolutions - 1 - resno));
  650|  8.80k|                pi->dx = !pi->dx ? dx : opj_uint_min(pi->dx, dx);
  ------------------
  |  Branch (650:26): [True: 1.38k, False: 7.41k]
  ------------------
  651|  8.80k|            }
  652|  11.6k|            if (res->pdy + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (652:17): [True: 9.17k, False: 2.42k]
  ------------------
  653|  11.6k|                    comp->dy <= UINT_MAX / (1u << (res->pdy + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (653:21): [True: 8.81k, False: 364]
  ------------------
  654|  8.81k|                dy = comp->dy * (1u << (res->pdy + comp->numresolutions - 1 - resno));
  655|  8.81k|                pi->dy = !pi->dy ? dy : opj_uint_min(pi->dy, dy);
  ------------------
  |  Branch (655:26): [True: 1.38k, False: 7.42k]
  ------------------
  656|  8.81k|            }
  657|  11.6k|        }
  658|  1.38k|        if (pi->dx == 0 || pi->dy == 0) {
  ------------------
  |  Branch (658:13): [True: 0, False: 1.38k]
  |  Branch (658:28): [True: 0, False: 1.38k]
  ------------------
  659|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  660|      0|        }
  661|  1.38k|        if (!pi->tp_on) {
  ------------------
  |  Branch (661:13): [True: 1.38k, False: 0]
  ------------------
  662|  1.38k|            pi->poc.ty0 = pi->ty0;
  663|  1.38k|            pi->poc.tx0 = pi->tx0;
  664|  1.38k|            pi->poc.ty1 = pi->ty1;
  665|  1.38k|            pi->poc.tx1 = pi->tx1;
  666|  1.38k|        }
  667|  4.59k|        for (pi->y = (OPJ_UINT32)pi->poc.ty0; pi->y < (OPJ_UINT32)pi->poc.ty1;
  ------------------
  |  Branch (667:47): [True: 3.41k, False: 1.17k]
  ------------------
  668|  3.41k|                pi->y += (pi->dy - (pi->y % pi->dy))) {
  669|   107k|            for (pi->x = (OPJ_UINT32)pi->poc.tx0; pi->x < (OPJ_UINT32)pi->poc.tx1;
  ------------------
  |  Branch (669:51): [True: 104k, False: 3.20k]
  ------------------
  670|   104k|                    pi->x += (pi->dx - (pi->x % pi->dx))) {
  671|   104k|                for (pi->resno = pi->poc.resno0;
  672|   419k|                        pi->resno < opj_uint_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
  ------------------
  |  Branch (672:25): [True: 315k, False: 104k]
  ------------------
  673|   315k|                    OPJ_UINT32 levelno;
  674|   315k|                    OPJ_UINT32 trx0, try0;
  675|   315k|                    OPJ_UINT32 trx1, try1;
  676|   315k|                    OPJ_UINT32 rpx, rpy;
  677|   315k|                    OPJ_UINT32 prci, prcj;
  678|   315k|                    res = &comp->resolutions[pi->resno];
  679|   315k|                    levelno = comp->numresolutions - 1 - pi->resno;
  680|       |
  681|   315k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
  ------------------
  |  Branch (681:25): [True: 0, False: 315k]
  ------------------
  682|   315k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
  ------------------
  |  Branch (682:29): [True: 0, False: 315k]
  ------------------
  683|      0|                        continue;
  684|      0|                    }
  685|       |
  686|   315k|                    trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
  687|   315k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  688|   315k|                    try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
  689|   315k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  690|   315k|                    trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
  691|   315k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  692|   315k|                    try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
  693|   315k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  694|   315k|                    rpx = res->pdx + levelno;
  695|   315k|                    rpy = res->pdy + levelno;
  696|       |
  697|   315k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
  ------------------
  |  Branch (697:25): [True: 0, False: 315k]
  ------------------
  698|   315k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
  ------------------
  |  Branch (698:29): [True: 0, False: 315k]
  ------------------
  699|      0|                        continue;
  700|      0|                    }
  701|       |
  702|       |                    /* See ISO-15441. B.12.1.5 Component-position-resolution level-layer progression */
  703|   315k|                    if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
  ------------------
  |  Branch (703:27): [True: 98.2k, False: 217k]
  ------------------
  704|   315k|                            ((pi->y == pi->ty0) &&
  ------------------
  |  Branch (704:30): [True: 120k, False: 96.3k]
  ------------------
  705|   217k|                             (((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
  ------------------
  |  Branch (705:30): [True: 120k, False: 141]
  ------------------
  706|  96.4k|                        continue;
  707|  96.4k|                    }
  708|   218k|                    if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
  ------------------
  |  Branch (708:27): [True: 107k, False: 110k]
  ------------------
  709|   218k|                            ((pi->x == pi->tx0) &&
  ------------------
  |  Branch (709:30): [True: 2.15k, False: 108k]
  ------------------
  710|   110k|                             (((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
  ------------------
  |  Branch (710:30): [True: 2.13k, False: 18]
  ------------------
  711|   108k|                        continue;
  712|   108k|                    }
  713|       |
  714|   109k|                    if ((res->pw == 0) || (res->ph == 0)) {
  ------------------
  |  Branch (714:25): [True: 1.24k, False: 108k]
  |  Branch (714:43): [True: 4.48k, False: 104k]
  ------------------
  715|  5.72k|                        continue;
  716|  5.72k|                    }
  717|       |
  718|   104k|                    if ((trx0 == trx1) || (try0 == try1)) {
  ------------------
  |  Branch (718:25): [True: 0, False: 104k]
  |  Branch (718:43): [True: 0, False: 104k]
  ------------------
  719|      0|                        continue;
  720|      0|                    }
  721|       |
  722|   104k|                    prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
  723|   104k|                                                 ((OPJ_UINT64)comp->dx << levelno)), res->pdx)
  724|   104k|                           - opj_uint_floordivpow2(trx0, res->pdx);
  725|   104k|                    prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
  726|   104k|                                                 ((OPJ_UINT64)comp->dy << levelno)), res->pdy)
  727|   104k|                           - opj_uint_floordivpow2(try0, res->pdy);
  728|   104k|                    pi->precno = (OPJ_UINT32)(prci + prcj * res->pw);
  729|  3.94M|                    for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (729:54): [True: 3.83M, False: 103k]
  ------------------
  730|  3.83M|                        index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  731|  3.83M|                                pi->step_c + pi->precno * pi->step_p;
  732|  3.83M|                        if (index >= pi->include_size) {
  ------------------
  |  Branch (732:29): [True: 0, False: 3.83M]
  ------------------
  733|      0|                            opj_event_msg(pi->manager, EVT_ERROR, "Invalid access to pi->include");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  734|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  735|      0|                        }
  736|  3.83M|                        if (!pi->include[index]) {
  ------------------
  |  Branch (736:29): [True: 3.83M, False: 94]
  ------------------
  737|  3.83M|                            pi->include[index] = 1;
  738|  3.83M|                            return OPJ_TRUE;
  ------------------
  |  |  117|  3.83M|#define OPJ_TRUE 1
  ------------------
  739|  3.83M|                        }
  740|  3.83M|LABEL_SKIP:
  741|  3.83M|                        ;
  742|  3.83M|                    }
  743|   104k|                }
  744|   104k|            }
  745|  3.41k|        }
  746|  1.38k|    }
  747|       |
  748|    561|    return OPJ_FALSE;
  ------------------
  |  |  118|    561|#define OPJ_FALSE 0
  ------------------
  749|    772|}

opj_sparse_array_int32_create:
   49|  3.57k|{
   50|  3.57k|    opj_sparse_array_int32_t* sa;
   51|       |
   52|  3.57k|    if (width == 0 || height == 0 || block_width == 0 || block_height == 0) {
  ------------------
  |  Branch (52:9): [True: 0, False: 3.57k]
  |  Branch (52:23): [True: 0, False: 3.57k]
  |  Branch (52:38): [True: 0, False: 3.57k]
  |  Branch (52:58): [True: 0, False: 3.57k]
  ------------------
   53|      0|        return NULL;
   54|      0|    }
   55|  3.57k|    if (block_width > ((OPJ_UINT32)~0U) / block_height / sizeof(OPJ_INT32)) {
  ------------------
  |  Branch (55:9): [True: 0, False: 3.57k]
  ------------------
   56|      0|        return NULL;
   57|      0|    }
   58|       |
   59|  3.57k|    sa = (opj_sparse_array_int32_t*) opj_calloc(1,
   60|  3.57k|            sizeof(opj_sparse_array_int32_t));
   61|  3.57k|    sa->width = width;
   62|  3.57k|    sa->height = height;
   63|  3.57k|    sa->block_width = block_width;
   64|  3.57k|    sa->block_height = block_height;
   65|  3.57k|    sa->block_count_hor = opj_uint_ceildiv(width, block_width);
   66|  3.57k|    sa->block_count_ver = opj_uint_ceildiv(height, block_height);
   67|  3.57k|    if (sa->block_count_hor > ((OPJ_UINT32)~0U) / sa->block_count_ver) {
  ------------------
  |  Branch (67:9): [True: 0, False: 3.57k]
  ------------------
   68|      0|        opj_free(sa);
   69|      0|        return NULL;
   70|      0|    }
   71|  3.57k|    sa->data_blocks = (OPJ_INT32**) opj_calloc(sizeof(OPJ_INT32*),
   72|  3.57k|                      (size_t) sa->block_count_hor * sa->block_count_ver);
   73|  3.57k|    if (sa->data_blocks == NULL) {
  ------------------
  |  Branch (73:9): [True: 0, False: 3.57k]
  ------------------
   74|      0|        opj_free(sa);
   75|      0|        return NULL;
   76|      0|    }
   77|       |
   78|  3.57k|    return sa;
   79|  3.57k|}
opj_sparse_array_int32_free:
   82|  3.57k|{
   83|  3.57k|    if (sa) {
  ------------------
  |  Branch (83:9): [True: 3.57k, False: 0]
  ------------------
   84|  3.57k|        OPJ_UINT32 i;
   85|  58.4M|        for (i = 0; i < sa->block_count_hor * sa->block_count_ver; i++) {
  ------------------
  |  Branch (85:21): [True: 58.4M, False: 3.57k]
  ------------------
   86|  58.4M|            if (sa->data_blocks[i]) {
  ------------------
  |  Branch (86:17): [True: 172k, False: 58.3M]
  ------------------
   87|   172k|                opj_free(sa->data_blocks[i]);
   88|   172k|            }
   89|  58.4M|        }
   90|  3.57k|        opj_free(sa->data_blocks);
   91|  3.57k|        opj_free(sa);
   92|  3.57k|    }
   93|  3.57k|}
opj_sparse_array_is_region_valid:
  100|  8.50M|{
  101|  8.50M|    return !(x0 >= sa->width || x1 <= x0 || x1 > sa->width ||
  ------------------
  |  Branch (101:14): [True: 1.48M, False: 7.02M]
  |  Branch (101:33): [True: 100k, False: 6.92M]
  |  Branch (101:45): [True: 0, False: 6.92M]
  ------------------
  102|  8.50M|             y0 >= sa->height || y1 <= y0 || y1 > sa->height);
  ------------------
  |  Branch (102:14): [True: 3.52k, False: 6.92M]
  |  Branch (102:34): [True: 10.2k, False: 6.90M]
  |  Branch (102:46): [True: 0, False: 6.90M]
  ------------------
  103|  8.50M|}
opj_sparse_array_int32_read:
  320|  5.59M|{
  321|  5.59M|    return opj_sparse_array_int32_read_or_write(
  322|  5.59M|               (opj_sparse_array_int32_t*)sa, x0, y0, x1, y1,
  323|  5.59M|               dest,
  324|  5.59M|               dest_col_stride,
  325|  5.59M|               dest_line_stride,
  326|  5.59M|               forgiving,
  327|  5.59M|               OPJ_TRUE);
  ------------------
  |  |  117|  5.59M|#define OPJ_TRUE 1
  ------------------
  328|  5.59M|}
opj_sparse_array_int32_write:
  339|  2.91M|{
  340|  2.91M|    return opj_sparse_array_int32_read_or_write(sa, x0, y0, x1, y1,
  341|  2.91M|            (OPJ_INT32*)src,
  342|  2.91M|            src_col_stride,
  343|  2.91M|            src_line_stride,
  344|  2.91M|            forgiving,
  345|  2.91M|            OPJ_FALSE);
  ------------------
  |  |  118|  2.91M|#define OPJ_FALSE 0
  ------------------
  346|  2.91M|}
sparse_array.c:opj_sparse_array_int32_read_or_write:
  116|  8.50M|{
  117|  8.50M|    OPJ_UINT32 y, block_y;
  118|  8.50M|    OPJ_UINT32 y_incr = 0;
  119|  8.50M|    const OPJ_UINT32 block_width = sa->block_width;
  120|       |
  121|  8.50M|    if (!opj_sparse_array_is_region_valid(sa, x0, y0, x1, y1)) {
  ------------------
  |  Branch (121:9): [True: 1.59M, False: 6.90M]
  ------------------
  122|  1.59M|        return forgiving;
  123|  1.59M|    }
  124|       |
  125|  6.90M|    block_y = y0 / sa->block_height;
  126|  16.1M|    for (y = y0; y < y1; block_y ++, y += y_incr) {
  ------------------
  |  Branch (126:18): [True: 9.22M, False: 6.90M]
  ------------------
  127|  9.22M|        OPJ_UINT32 x, block_x;
  128|  9.22M|        OPJ_UINT32 x_incr = 0;
  129|  9.22M|        OPJ_UINT32 block_y_offset;
  130|  9.22M|        y_incr = (y == y0) ? sa->block_height - (y0 % sa->block_height) :
  ------------------
  |  Branch (130:18): [True: 6.90M, False: 2.31M]
  ------------------
  131|  9.22M|                 sa->block_height;
  132|  9.22M|        block_y_offset = sa->block_height - y_incr;
  133|  9.22M|        y_incr = opj_uint_min(y_incr, y1 - y);
  134|  9.22M|        block_x = x0 / block_width;
  135|  27.0M|        for (x = x0; x < x1; block_x ++, x += x_incr) {
  ------------------
  |  Branch (135:22): [True: 17.8M, False: 9.22M]
  ------------------
  136|  17.8M|            OPJ_UINT32 j;
  137|  17.8M|            OPJ_UINT32 block_x_offset;
  138|  17.8M|            OPJ_INT32* src_block;
  139|  17.8M|            x_incr = (x == x0) ? block_width - (x0 % block_width) : block_width;
  ------------------
  |  Branch (139:22): [True: 9.22M, False: 8.61M]
  ------------------
  140|  17.8M|            block_x_offset = block_width - x_incr;
  141|  17.8M|            x_incr = opj_uint_min(x_incr, x1 - x);
  142|  17.8M|            src_block = sa->data_blocks[block_y * sa->block_count_hor + block_x];
  143|  17.8M|            if (is_read_op) {
  ------------------
  |  Branch (143:17): [True: 10.3M, False: 7.52M]
  ------------------
  144|  10.3M|                if (src_block == NULL) {
  ------------------
  |  Branch (144:21): [True: 147, False: 10.3M]
  ------------------
  145|    147|                    if (buf_col_stride == 1) {
  ------------------
  |  Branch (145:25): [True: 0, False: 147]
  ------------------
  146|      0|                        OPJ_INT32* dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride +
  147|      0|                                              (x - x0) * buf_col_stride;
  148|      0|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (148:37): [True: 0, False: 0]
  ------------------
  149|      0|                            memset(dest_ptr, 0, sizeof(OPJ_INT32) * x_incr);
  150|      0|                            dest_ptr += buf_line_stride;
  151|      0|                        }
  152|    147|                    } else {
  153|    147|                        OPJ_INT32* dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride +
  154|    147|                                              (x - x0) * buf_col_stride;
  155|    294|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (155:37): [True: 147, False: 147]
  ------------------
  156|    147|                            OPJ_UINT32 k;
  157|  2.05k|                            for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (157:41): [True: 1.90k, False: 147]
  ------------------
  158|  1.90k|                                dest_ptr[k * buf_col_stride] = 0;
  159|  1.90k|                            }
  160|    147|                            dest_ptr += buf_line_stride;
  161|    147|                        }
  162|    147|                    }
  163|  10.3M|                } else {
  164|  10.3M|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = src_block + block_y_offset *
  165|  10.3M|                                                            (OPJ_SIZE_T)block_width + block_x_offset;
  166|  10.3M|                    if (buf_col_stride == 1) {
  ------------------
  |  Branch (166:25): [True: 1.55M, False: 8.74M]
  ------------------
  167|  1.55M|                        OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride
  168|  1.55M|                                                           +
  169|  1.55M|                                                           (x - x0) * buf_col_stride;
  170|  1.55M|                        if (x_incr == 4) {
  ------------------
  |  Branch (170:29): [True: 1.07M, False: 482k]
  ------------------
  171|       |                            /* Same code as general branch, but the compiler */
  172|       |                            /* can have an efficient memcpy() */
  173|  1.07M|                            (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
  174|  55.0M|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (174:41): [True: 53.9M, False: 1.07M]
  ------------------
  175|  53.9M|                                memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  176|  53.9M|                                dest_ptr += buf_line_stride;
  177|  53.9M|                                src_ptr += block_width;
  178|  53.9M|                            }
  179|  1.07M|                        } else {
  180|  25.1M|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (180:41): [True: 24.6M, False: 482k]
  ------------------
  181|  24.6M|                                memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  182|  24.6M|                                dest_ptr += buf_line_stride;
  183|  24.6M|                                src_ptr += block_width;
  184|  24.6M|                            }
  185|   482k|                        }
  186|  8.74M|                    } else {
  187|  8.74M|                        OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride
  188|  8.74M|                                                           +
  189|  8.74M|                                                           (x - x0) * buf_col_stride;
  190|  8.74M|                        if (x_incr == 1) {
  ------------------
  |  Branch (190:29): [True: 1.56M, False: 7.18M]
  ------------------
  191|  3.12M|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (191:41): [True: 1.56M, False: 1.56M]
  ------------------
  192|  1.56M|                                *dest_ptr = *src_ptr;
  193|  1.56M|                                dest_ptr += buf_line_stride;
  194|  1.56M|                                src_ptr += block_width;
  195|  1.56M|                            }
  196|  7.18M|                        } else if (y_incr == 1 && buf_col_stride == 2) {
  ------------------
  |  Branch (196:36): [True: 7.18M, False: 0]
  |  Branch (196:51): [True: 4.59M, False: 2.58M]
  ------------------
  197|  4.59M|                            OPJ_UINT32 k;
  198|  57.6M|                            for (k = 0; k < (x_incr & ~3U); k += 4) {
  ------------------
  |  Branch (198:41): [True: 53.0M, False: 4.59M]
  ------------------
  199|  53.0M|                                dest_ptr[k * buf_col_stride] = src_ptr[k];
  200|  53.0M|                                dest_ptr[(k + 1) * buf_col_stride] = src_ptr[k + 1];
  201|  53.0M|                                dest_ptr[(k + 2) * buf_col_stride] = src_ptr[k + 2];
  202|  53.0M|                                dest_ptr[(k + 3) * buf_col_stride] = src_ptr[k + 3];
  203|  53.0M|                            }
  204|  8.26M|                            for (; k < x_incr; k++) {
  ------------------
  |  Branch (204:36): [True: 3.66M, False: 4.59M]
  ------------------
  205|  3.66M|                                dest_ptr[k * buf_col_stride] = src_ptr[k];
  206|  3.66M|                            }
  207|  4.59M|                        } else if (x_incr >= 8 && buf_col_stride == 8) {
  ------------------
  |  Branch (207:36): [True: 2.21M, False: 371k]
  |  Branch (207:51): [True: 0, False: 2.21M]
  ------------------
  208|      0|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (208:41): [True: 0, False: 0]
  ------------------
  209|      0|                                OPJ_UINT32 k;
  210|      0|                                for (k = 0; k < (x_incr & ~3U); k += 4) {
  ------------------
  |  Branch (210:45): [True: 0, False: 0]
  ------------------
  211|      0|                                    dest_ptr[k * buf_col_stride] = src_ptr[k];
  212|      0|                                    dest_ptr[(k + 1) * buf_col_stride] = src_ptr[k + 1];
  213|      0|                                    dest_ptr[(k + 2) * buf_col_stride] = src_ptr[k + 2];
  214|      0|                                    dest_ptr[(k + 3) * buf_col_stride] = src_ptr[k + 3];
  215|      0|                                }
  216|      0|                                for (; k < x_incr; k++) {
  ------------------
  |  Branch (216:40): [True: 0, False: 0]
  ------------------
  217|      0|                                    dest_ptr[k * buf_col_stride] = src_ptr[k];
  218|      0|                                }
  219|      0|                                dest_ptr += buf_line_stride;
  220|      0|                                src_ptr += block_width;
  221|      0|                            }
  222|  2.58M|                        } else {
  223|       |                            /* General case */
  224|  5.17M|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (224:41): [True: 2.58M, False: 2.58M]
  ------------------
  225|  2.58M|                                OPJ_UINT32 k;
  226|   140M|                                for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (226:45): [True: 137M, False: 2.58M]
  ------------------
  227|   137M|                                    dest_ptr[k * buf_col_stride] = src_ptr[k];
  228|   137M|                                }
  229|  2.58M|                                dest_ptr += buf_line_stride;
  230|  2.58M|                                src_ptr += block_width;
  231|  2.58M|                            }
  232|  2.58M|                        }
  233|  8.74M|                    }
  234|  10.3M|                }
  235|  10.3M|            } else {
  236|  7.52M|                if (src_block == NULL) {
  ------------------
  |  Branch (236:21): [True: 172k, False: 7.35M]
  ------------------
  237|   172k|                    src_block = (OPJ_INT32*) opj_calloc(1,
  238|   172k|                                                        (size_t) sa->block_width * sa->block_height * sizeof(OPJ_INT32));
  239|   172k|                    if (src_block == NULL) {
  ------------------
  |  Branch (239:25): [True: 0, False: 172k]
  ------------------
  240|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  241|      0|                    }
  242|   172k|                    sa->data_blocks[block_y * sa->block_count_hor + block_x] = src_block;
  243|   172k|                }
  244|       |
  245|  7.52M|                if (buf_col_stride == 1) {
  ------------------
  |  Branch (245:21): [True: 7.23M, False: 295k]
  ------------------
  246|  7.23M|                    OPJ_INT32* OPJ_RESTRICT dest_ptr = src_block + block_y_offset *
  247|  7.23M|                                                       (OPJ_SIZE_T)block_width + block_x_offset;
  248|  7.23M|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = buf + (y - y0) *
  249|  7.23M|                                                            (OPJ_SIZE_T)buf_line_stride + (x - x0) * buf_col_stride;
  250|  7.23M|                    if (x_incr == 4) {
  ------------------
  |  Branch (250:25): [True: 1.09M, False: 6.13M]
  ------------------
  251|       |                        /* Same code as general branch, but the compiler */
  252|       |                        /* can have an efficient memcpy() */
  253|  1.09M|                        (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
  254|  55.7M|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (254:37): [True: 54.6M, False: 1.09M]
  ------------------
  255|  54.6M|                            memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  256|  54.6M|                            dest_ptr += block_width;
  257|  54.6M|                            src_ptr += buf_line_stride;
  258|  54.6M|                        }
  259|  6.13M|                    } else {
  260|  42.1M|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (260:37): [True: 35.9M, False: 6.13M]
  ------------------
  261|  35.9M|                            memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  262|  35.9M|                            dest_ptr += block_width;
  263|  35.9M|                            src_ptr += buf_line_stride;
  264|  35.9M|                        }
  265|  6.13M|                    }
  266|  7.23M|                } else {
  267|   295k|                    OPJ_INT32* OPJ_RESTRICT dest_ptr = src_block + block_y_offset *
  268|   295k|                                                       (OPJ_SIZE_T)block_width + block_x_offset;
  269|   295k|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = buf + (y - y0) *
  270|   295k|                                                            (OPJ_SIZE_T)buf_line_stride + (x - x0) * buf_col_stride;
  271|   295k|                    if (x_incr == 1) {
  ------------------
  |  Branch (271:25): [True: 1.52k, False: 294k]
  ------------------
  272|  13.3k|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (272:37): [True: 11.7k, False: 1.52k]
  ------------------
  273|  11.7k|                            *dest_ptr = *src_ptr;
  274|  11.7k|                            src_ptr += buf_line_stride;
  275|  11.7k|                            dest_ptr += block_width;
  276|  11.7k|                        }
  277|   294k|                    } else if (x_incr >= 8 && buf_col_stride == 8) {
  ------------------
  |  Branch (277:32): [True: 292k, False: 1.32k]
  |  Branch (277:47): [True: 292k, False: 0]
  ------------------
  278|  2.62M|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (278:37): [True: 2.33M, False: 292k]
  ------------------
  279|  2.33M|                            OPJ_UINT32 k;
  280|  36.6M|                            for (k = 0; k < (x_incr & ~3U); k += 4) {
  ------------------
  |  Branch (280:41): [True: 34.3M, False: 2.33M]
  ------------------
  281|  34.3M|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  282|  34.3M|                                dest_ptr[k + 1] = src_ptr[(k + 1) * buf_col_stride];
  283|  34.3M|                                dest_ptr[k + 2] = src_ptr[(k + 2) * buf_col_stride];
  284|  34.3M|                                dest_ptr[k + 3] = src_ptr[(k + 3) * buf_col_stride];
  285|  34.3M|                            }
  286|  2.61M|                            for (; k < x_incr; k++) {
  ------------------
  |  Branch (286:36): [True: 280k, False: 2.33M]
  ------------------
  287|   280k|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  288|   280k|                            }
  289|  2.33M|                            src_ptr += buf_line_stride;
  290|  2.33M|                            dest_ptr += block_width;
  291|  2.33M|                        }
  292|   292k|                    } else {
  293|       |                        /* General case */
  294|  11.2k|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (294:37): [True: 9.88k, False: 1.32k]
  ------------------
  295|  9.88k|                            OPJ_UINT32 k;
  296|  53.2k|                            for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (296:41): [True: 43.3k, False: 9.88k]
  ------------------
  297|  43.3k|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  298|  43.3k|                            }
  299|  9.88k|                            src_ptr += buf_line_stride;
  300|  9.88k|                            dest_ptr += block_width;
  301|  9.88k|                        }
  302|  1.32k|                    }
  303|   295k|                }
  304|  7.52M|            }
  305|  17.8M|        }
  306|  9.22M|    }
  307|       |
  308|  6.90M|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.90M|#define OPJ_TRUE 1
  ------------------
  309|  6.90M|}

opj_t1_create:
 1551|  1.87k|{
 1552|  1.87k|    opj_t1_t *l_t1 = 00;
 1553|       |
 1554|  1.87k|    l_t1 = (opj_t1_t*) opj_calloc(1, sizeof(opj_t1_t));
 1555|  1.87k|    if (!l_t1) {
  ------------------
  |  Branch (1555:9): [True: 0, False: 1.87k]
  ------------------
 1556|      0|        return 00;
 1557|      0|    }
 1558|       |
 1559|  1.87k|    l_t1->encoder = isEncoder;
 1560|       |
 1561|  1.87k|    return l_t1;
 1562|  1.87k|}
opj_t1_destroy:
 1571|  1.87k|{
 1572|  1.87k|    if (! p_t1) {
  ------------------
  |  Branch (1572:9): [True: 0, False: 1.87k]
  ------------------
 1573|      0|        return;
 1574|      0|    }
 1575|       |
 1576|  1.87k|    if (p_t1->data) {
  ------------------
  |  Branch (1576:9): [True: 1.87k, False: 0]
  ------------------
 1577|  1.87k|        opj_aligned_free(p_t1->data);
 1578|  1.87k|        p_t1->data = 00;
 1579|  1.87k|    }
 1580|       |
 1581|  1.87k|    if (p_t1->flags) {
  ------------------
  |  Branch (1581:9): [True: 1.87k, False: 0]
  ------------------
 1582|  1.87k|        opj_aligned_free(p_t1->flags);
 1583|  1.87k|        p_t1->flags = 00;
 1584|  1.87k|    }
 1585|       |
 1586|  1.87k|    opj_free(p_t1->cblkdatabuffer);
 1587|       |
 1588|  1.87k|    opj_free(p_t1);
 1589|  1.87k|}
opj_t1_decode_cblks:
 1880|  12.6k|{
 1881|  12.6k|    opj_thread_pool_t* tp = tcd->thread_pool;
 1882|  12.6k|    OPJ_UINT32 resno, bandno, precno, cblkno;
 1883|       |
 1884|       |#ifdef DEBUG_VERBOSE
 1885|       |    OPJ_UINT32 codeblocks_decoded = 0;
 1886|       |    printf("Enter opj_t1_decode_cblks()\n");
 1887|       |#endif
 1888|       |
 1889|   170k|    for (resno = 0; resno < tilec->minimum_num_resolutions; ++resno) {
  ------------------
  |  Branch (1889:21): [True: 158k, False: 12.5k]
  ------------------
 1890|   158k|        opj_tcd_resolution_t* res = &tilec->resolutions[resno];
 1891|       |
 1892|   607k|        for (bandno = 0; bandno < res->numbands; ++bandno) {
  ------------------
  |  Branch (1892:26): [True: 449k, False: 158k]
  ------------------
 1893|   449k|            opj_tcd_band_t* OPJ_RESTRICT band = &res->bands[bandno];
 1894|       |
 1895|  2.02M|            for (precno = 0; precno < res->pw * res->ph; ++precno) {
  ------------------
  |  Branch (1895:30): [True: 1.57M, False: 449k]
  ------------------
 1896|  1.57M|                opj_tcd_precinct_t* precinct = &band->precincts[precno];
 1897|       |
 1898|  1.57M|                if (!opj_tcd_is_subband_area_of_interest(tcd,
  ------------------
  |  Branch (1898:21): [True: 1.34M, False: 227k]
  ------------------
 1899|  1.57M|                        tilec->compno,
 1900|  1.57M|                        resno,
 1901|  1.57M|                        band->bandno,
 1902|  1.57M|                        (OPJ_UINT32)precinct->x0,
 1903|  1.57M|                        (OPJ_UINT32)precinct->y0,
 1904|  1.57M|                        (OPJ_UINT32)precinct->x1,
 1905|  1.57M|                        (OPJ_UINT32)precinct->y1)) {
 1906|   122M|                    for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (1906:38): [True: 120M, False: 1.34M]
  ------------------
 1907|   120M|                        opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 1908|   120M|                        if (cblk->decoded_data) {
  ------------------
  |  Branch (1908:29): [True: 0, False: 120M]
  ------------------
 1909|       |#ifdef DEBUG_VERBOSE
 1910|       |                            printf("Discarding codeblock %d,%d at resno=%d, bandno=%d\n",
 1911|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1912|       |#endif
 1913|      0|                            opj_aligned_free(cblk->decoded_data);
 1914|      0|                            cblk->decoded_data = NULL;
 1915|      0|                        }
 1916|   120M|                    }
 1917|  1.34M|                    continue;
 1918|  1.34M|                }
 1919|       |
 1920|  9.62M|                for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (1920:34): [True: 9.39M, False: 227k]
  ------------------
 1921|  9.39M|                    opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 1922|  9.39M|                    opj_t1_cblk_decode_processing_job_t* job;
 1923|       |
 1924|  9.39M|                    if (!opj_tcd_is_subband_area_of_interest(tcd,
  ------------------
  |  Branch (1924:25): [True: 8.02M, False: 1.36M]
  ------------------
 1925|  9.39M|                            tilec->compno,
 1926|  9.39M|                            resno,
 1927|  9.39M|                            band->bandno,
 1928|  9.39M|                            (OPJ_UINT32)cblk->x0,
 1929|  9.39M|                            (OPJ_UINT32)cblk->y0,
 1930|  9.39M|                            (OPJ_UINT32)cblk->x1,
 1931|  9.39M|                            (OPJ_UINT32)cblk->y1)) {
 1932|  8.02M|                        if (cblk->decoded_data) {
  ------------------
  |  Branch (1932:29): [True: 0, False: 8.02M]
  ------------------
 1933|       |#ifdef DEBUG_VERBOSE
 1934|       |                            printf("Discarding codeblock %d,%d at resno=%d, bandno=%d\n",
 1935|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1936|       |#endif
 1937|      0|                            opj_aligned_free(cblk->decoded_data);
 1938|      0|                            cblk->decoded_data = NULL;
 1939|      0|                        }
 1940|  8.02M|                        continue;
 1941|  8.02M|                    }
 1942|       |
 1943|  1.36M|                    if (!tcd->whole_tile_decoding) {
  ------------------
  |  Branch (1943:25): [True: 511k, False: 858k]
  ------------------
 1944|   511k|                        OPJ_UINT32 cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 1945|   511k|                        OPJ_UINT32 cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 1946|   511k|                        if (cblk->decoded_data != NULL) {
  ------------------
  |  Branch (1946:29): [True: 0, False: 511k]
  ------------------
 1947|       |#ifdef DEBUG_VERBOSE
 1948|       |                            printf("Reusing codeblock %d,%d at resno=%d, bandno=%d\n",
 1949|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1950|       |#endif
 1951|      0|                            continue;
 1952|      0|                        }
 1953|   511k|                        if (cblk_w == 0 || cblk_h == 0) {
  ------------------
  |  Branch (1953:29): [True: 21.5k, False: 489k]
  |  Branch (1953:44): [True: 6.71k, False: 483k]
  ------------------
 1954|  28.2k|                            continue;
 1955|  28.2k|                        }
 1956|       |#ifdef DEBUG_VERBOSE
 1957|       |                        printf("Decoding codeblock %d,%d at resno=%d, bandno=%d\n",
 1958|       |                               cblk->x0, cblk->y0, resno, bandno);
 1959|       |#endif
 1960|   511k|                    }
 1961|       |
 1962|  1.34M|                    job = (opj_t1_cblk_decode_processing_job_t*) opj_calloc(1,
 1963|  1.34M|                            sizeof(opj_t1_cblk_decode_processing_job_t));
 1964|  1.34M|                    if (!job) {
  ------------------
  |  Branch (1964:25): [True: 0, False: 1.34M]
  ------------------
 1965|      0|                        *pret = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1966|      0|                        return;
 1967|      0|                    }
 1968|  1.34M|                    job->whole_tile_decoding = tcd->whole_tile_decoding;
 1969|  1.34M|                    job->resno = resno;
 1970|  1.34M|                    job->cblk = cblk;
 1971|  1.34M|                    job->band = band;
 1972|  1.34M|                    job->tilec = tilec;
 1973|  1.34M|                    job->tccp = tccp;
 1974|  1.34M|                    job->pret = pret;
 1975|  1.34M|                    job->p_manager_mutex = p_manager_mutex;
 1976|  1.34M|                    job->p_manager = p_manager;
 1977|  1.34M|                    job->check_pterm = check_pterm;
 1978|  1.34M|                    job->mustuse_cblkdatabuffer = opj_thread_pool_get_thread_count(tp) > 1;
 1979|  1.34M|                    opj_thread_pool_submit_job(tp, opj_t1_clbl_decode_processor, job);
 1980|       |#ifdef DEBUG_VERBOSE
 1981|       |                    codeblocks_decoded ++;
 1982|       |#endif
 1983|  1.34M|                    if (!(*pret)) {
  ------------------
  |  Branch (1983:25): [True: 83, False: 1.34M]
  ------------------
 1984|     83|                        return;
 1985|     83|                    }
 1986|  1.34M|                } /* cblkno */
 1987|   227k|            } /* precno */
 1988|   449k|        } /* bandno */
 1989|   158k|    } /* resno */
 1990|       |
 1991|       |#ifdef DEBUG_VERBOSE
 1992|       |    printf("Leave opj_t1_decode_cblks(). Number decoded: %d\n", codeblocks_decoded);
 1993|       |#endif
 1994|  12.5k|    return;
 1995|  12.6k|}
t1.c:opj_t1_clbl_decode_processor:
 1611|  1.34M|{
 1612|  1.34M|    opj_tcd_cblk_dec_t* cblk;
 1613|  1.34M|    opj_tcd_band_t* band;
 1614|  1.34M|    opj_tcd_tilecomp_t* tilec;
 1615|  1.34M|    opj_tccp_t* tccp;
 1616|  1.34M|    OPJ_INT32* OPJ_RESTRICT datap;
 1617|  1.34M|    OPJ_UINT32 cblk_w, cblk_h;
 1618|  1.34M|    OPJ_INT32 x, y;
 1619|  1.34M|    OPJ_UINT32 i, j;
 1620|  1.34M|    opj_t1_cblk_decode_processing_job_t* job;
 1621|  1.34M|    opj_t1_t* t1;
 1622|  1.34M|    OPJ_UINT32 resno;
 1623|  1.34M|    OPJ_UINT32 tile_w;
 1624|       |
 1625|  1.34M|    job = (opj_t1_cblk_decode_processing_job_t*) user_data;
 1626|       |
 1627|  1.34M|    cblk = job->cblk;
 1628|       |
 1629|  1.34M|    if (!job->whole_tile_decoding) {
  ------------------
  |  Branch (1629:9): [True: 483k, False: 858k]
  ------------------
 1630|   483k|        cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 1631|   483k|        cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 1632|       |
 1633|   483k|        cblk->decoded_data = (OPJ_INT32*)opj_aligned_malloc(sizeof(OPJ_INT32) *
 1634|   483k|                             cblk_w * cblk_h);
 1635|   483k|        if (cblk->decoded_data == NULL) {
  ------------------
  |  Branch (1635:13): [True: 0, False: 483k]
  ------------------
 1636|      0|            if (job->p_manager_mutex) {
  ------------------
  |  Branch (1636:17): [True: 0, False: 0]
  ------------------
 1637|      0|                opj_mutex_lock(job->p_manager_mutex);
 1638|      0|            }
 1639|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1640|      0|                          "Cannot allocate cblk->decoded_data\n");
 1641|      0|            if (job->p_manager_mutex) {
  ------------------
  |  Branch (1641:17): [True: 0, False: 0]
  ------------------
 1642|      0|                opj_mutex_unlock(job->p_manager_mutex);
 1643|      0|            }
 1644|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1645|      0|            opj_free(job);
 1646|      0|            return;
 1647|      0|        }
 1648|       |        /* Zero-init required */
 1649|   483k|        memset(cblk->decoded_data, 0, sizeof(OPJ_INT32) * cblk_w * cblk_h);
 1650|   858k|    } else if (cblk->decoded_data) {
  ------------------
  |  Branch (1650:16): [True: 0, False: 858k]
  ------------------
 1651|       |        /* Not sure if that code path can happen, but better be */
 1652|       |        /* safe than sorry */
 1653|      0|        opj_aligned_free(cblk->decoded_data);
 1654|      0|        cblk->decoded_data = NULL;
 1655|      0|    }
 1656|       |
 1657|  1.34M|    resno = job->resno;
 1658|  1.34M|    band = job->band;
 1659|  1.34M|    tilec = job->tilec;
 1660|  1.34M|    tccp = job->tccp;
 1661|  1.34M|    tile_w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions - 1].x1
 1662|  1.34M|                          -
 1663|  1.34M|                          tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 1664|       |
 1665|  1.34M|    if (!*(job->pret)) {
  ------------------
  |  Branch (1665:9): [True: 0, False: 1.34M]
  ------------------
 1666|      0|        opj_free(job);
 1667|      0|        return;
 1668|      0|    }
 1669|       |
 1670|  1.34M|    t1 = (opj_t1_t*) opj_tls_get(tls, OPJ_TLS_KEY_T1);
  ------------------
  |  |   35|  1.34M|#define OPJ_TLS_KEY_T1  0
  ------------------
 1671|  1.34M|    if (t1 == NULL) {
  ------------------
  |  Branch (1671:9): [True: 1.87k, False: 1.33M]
  ------------------
 1672|  1.87k|        t1 = opj_t1_create(OPJ_FALSE);
  ------------------
  |  |  118|  1.87k|#define OPJ_FALSE 0
  ------------------
 1673|  1.87k|        if (t1 == NULL) {
  ------------------
  |  Branch (1673:13): [True: 0, False: 1.87k]
  ------------------
 1674|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1675|      0|                          "Cannot allocate Tier 1 handle\n");
 1676|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1677|      0|            opj_free(job);
 1678|      0|            return;
 1679|      0|        }
 1680|  1.87k|        if (!opj_tls_set(tls, OPJ_TLS_KEY_T1, t1, opj_t1_destroy_wrapper)) {
  ------------------
  |  |   35|  1.87k|#define OPJ_TLS_KEY_T1  0
  ------------------
  |  Branch (1680:13): [True: 0, False: 1.87k]
  ------------------
 1681|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1682|      0|                          "Unable to set t1 handle as TLS\n");
 1683|      0|            opj_t1_destroy(t1);
 1684|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1685|      0|            opj_free(job);
 1686|      0|            return;
 1687|      0|        }
 1688|  1.87k|    }
 1689|  1.34M|    t1->mustuse_cblkdatabuffer = job->mustuse_cblkdatabuffer;
 1690|       |
 1691|  1.34M|    if ((tccp->cblksty & J2K_CCP_CBLKSTY_HT) != 0) {
  ------------------
  |  |   64|  1.34M|#define J2K_CCP_CBLKSTY_HT 0x40       /**< (high throughput) HT codeblocks */
  ------------------
  |  Branch (1691:9): [True: 60.2k, False: 1.28M]
  ------------------
 1692|  60.2k|        if (OPJ_FALSE == opj_t1_ht_decode_cblk(
  ------------------
  |  |  118|  60.2k|#define OPJ_FALSE 0
  ------------------
  |  Branch (1692:13): [True: 78, False: 60.1k]
  ------------------
 1693|  60.2k|                    t1,
 1694|  60.2k|                    cblk,
 1695|  60.2k|                    band->bandno,
 1696|  60.2k|                    (OPJ_UINT32)tccp->roishift,
 1697|  60.2k|                    tccp->cblksty,
 1698|  60.2k|                    job->p_manager,
 1699|  60.2k|                    job->p_manager_mutex,
 1700|  60.2k|                    job->check_pterm)) {
 1701|     78|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|     78|#define OPJ_FALSE 0
  ------------------
 1702|     78|            opj_free(job);
 1703|     78|            return;
 1704|     78|        }
 1705|  1.28M|    } else {
 1706|  1.28M|        if (OPJ_FALSE == opj_t1_decode_cblk(
  ------------------
  |  |  118|  1.28M|#define OPJ_FALSE 0
  ------------------
  |  Branch (1706:13): [True: 5, False: 1.28M]
  ------------------
 1707|  1.28M|                    t1,
 1708|  1.28M|                    cblk,
 1709|  1.28M|                    band->bandno,
 1710|  1.28M|                    (OPJ_UINT32)tccp->roishift,
 1711|  1.28M|                    tccp->cblksty,
 1712|  1.28M|                    job->p_manager,
 1713|  1.28M|                    job->p_manager_mutex,
 1714|  1.28M|                    job->check_pterm)) {
 1715|      5|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 1716|      5|            opj_free(job);
 1717|      5|            return;
 1718|      5|        }
 1719|  1.28M|    }
 1720|       |
 1721|  1.34M|    x = cblk->x0 - band->x0;
 1722|  1.34M|    y = cblk->y0 - band->y0;
 1723|  1.34M|    if (band->bandno & 1) {
  ------------------
  |  Branch (1723:9): [True: 695k, False: 646k]
  ------------------
 1724|   695k|        opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 1725|   695k|        x += pres->x1 - pres->x0;
 1726|   695k|    }
 1727|  1.34M|    if (band->bandno & 2) {
  ------------------
  |  Branch (1727:9): [True: 721k, False: 619k]
  ------------------
 1728|   721k|        opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 1729|   721k|        y += pres->y1 - pres->y0;
 1730|   721k|    }
 1731|       |
 1732|  1.34M|    datap = cblk->decoded_data ? cblk->decoded_data : t1->data;
  ------------------
  |  Branch (1732:13): [True: 483k, False: 858k]
  ------------------
 1733|  1.34M|    cblk_w = t1->w;
 1734|  1.34M|    cblk_h = t1->h;
 1735|       |
 1736|  1.34M|    if (tccp->roishift) {
  ------------------
  |  Branch (1736:9): [True: 1.39k, False: 1.34M]
  ------------------
 1737|  1.39k|        if (tccp->roishift >= 31) {
  ------------------
  |  Branch (1737:13): [True: 0, False: 1.39k]
  ------------------
 1738|      0|            for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1738:25): [True: 0, False: 0]
  ------------------
 1739|      0|                for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1739:29): [True: 0, False: 0]
  ------------------
 1740|      0|                    datap[(j * cblk_w) + i] = 0;
 1741|      0|                }
 1742|      0|            }
 1743|  1.39k|        } else {
 1744|  1.39k|            OPJ_INT32 thresh = 1 << tccp->roishift;
 1745|  18.1k|            for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1745:25): [True: 16.7k, False: 1.39k]
  ------------------
 1746|   316k|                for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1746:29): [True: 299k, False: 16.7k]
  ------------------
 1747|   299k|                    OPJ_INT32 val = datap[(j * cblk_w) + i];
 1748|   299k|                    OPJ_INT32 mag = abs(val);
 1749|   299k|                    if (mag >= thresh) {
  ------------------
  |  Branch (1749:25): [True: 1.17k, False: 298k]
  ------------------
 1750|  1.17k|                        mag >>= tccp->roishift;
 1751|  1.17k|                        datap[(j * cblk_w) + i] = val < 0 ? -mag : mag;
  ------------------
  |  Branch (1751:51): [True: 630, False: 543]
  ------------------
 1752|  1.17k|                    }
 1753|   299k|                }
 1754|  16.7k|            }
 1755|  1.39k|        }
 1756|  1.39k|    }
 1757|       |
 1758|       |    /* Both can be non NULL if for example decoding a full tile and then */
 1759|       |    /* partially a tile. In which case partial decoding should be the */
 1760|       |    /* priority */
 1761|  1.34M|    assert((cblk->decoded_data != NULL) || (tilec->data != NULL));
 1762|       |
 1763|  1.34M|    if (cblk->decoded_data) {
  ------------------
  |  Branch (1763:9): [True: 483k, False: 858k]
  ------------------
 1764|   483k|        OPJ_UINT32 cblk_size = cblk_w * cblk_h;
 1765|   483k|        if (tccp->qmfbid == 1) {
  ------------------
  |  Branch (1765:13): [True: 224k, False: 258k]
  ------------------
 1766|   236M|            for (i = 0; i < cblk_size; ++i) {
  ------------------
  |  Branch (1766:25): [True: 236M, False: 224k]
  ------------------
 1767|   236M|                datap[i] /= 2;
 1768|   236M|            }
 1769|   258k|        } else {        /* if (tccp->qmfbid == 0) */
 1770|   258k|            const float stepsize = 0.5f * band->stepsize;
 1771|   258k|            i = 0;
 1772|   258k|#ifdef __SSE2__
 1773|   258k|            {
 1774|   258k|                const __m128 xmm_stepsize = _mm_set1_ps(stepsize);
 1775|  9.68M|                for (; i < (cblk_size & ~15U); i += 16) {
  ------------------
  |  Branch (1775:24): [True: 9.42M, False: 258k]
  ------------------
 1776|  9.42M|                    __m128 xmm0_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1777|  9.42M|                                                           datap + 0)));
 1778|  9.42M|                    __m128 xmm1_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1779|  9.42M|                                                           datap + 4)));
 1780|  9.42M|                    __m128 xmm2_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1781|  9.42M|                                                           datap + 8)));
 1782|  9.42M|                    __m128 xmm3_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1783|  9.42M|                                                           datap + 12)));
 1784|  9.42M|                    _mm_store_ps((float*)(datap +  0), _mm_mul_ps(xmm0_data, xmm_stepsize));
 1785|  9.42M|                    _mm_store_ps((float*)(datap +  4), _mm_mul_ps(xmm1_data, xmm_stepsize));
 1786|  9.42M|                    _mm_store_ps((float*)(datap +  8), _mm_mul_ps(xmm2_data, xmm_stepsize));
 1787|  9.42M|                    _mm_store_ps((float*)(datap + 12), _mm_mul_ps(xmm3_data, xmm_stepsize));
 1788|  9.42M|                    datap += 16;
 1789|  9.42M|                }
 1790|   258k|            }
 1791|   258k|#endif
 1792|   428k|            for (; i < cblk_size; ++i) {
  ------------------
  |  Branch (1792:20): [True: 169k, False: 258k]
  ------------------
 1793|   169k|                OPJ_FLOAT32 tmp = ((OPJ_FLOAT32)(*datap)) * stepsize;
 1794|   169k|                memcpy(datap, &tmp, sizeof(tmp));
 1795|   169k|                datap++;
 1796|   169k|            }
 1797|   258k|        }
 1798|   858k|    } else if (tccp->qmfbid == 1) {
  ------------------
  |  Branch (1798:16): [True: 200k, False: 658k]
  ------------------
 1799|   200k|        OPJ_INT32* OPJ_RESTRICT tiledp = &tilec->data[(OPJ_SIZE_T)y * tile_w +
 1800|   200k|                                                       (OPJ_SIZE_T)x];
 1801|  3.29M|        for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1801:21): [True: 3.09M, False: 200k]
  ------------------
 1802|       |            //positive -> round down aka.  (83)/2 =  41.5 ->  41
 1803|       |            //negative -> round up   aka. (-83)/2 = -41.5 -> -41
 1804|       |#if defined(__AVX512F__)
 1805|       |            OPJ_INT32* ptr_in = datap + (j * cblk_w);
 1806|       |            OPJ_INT32* ptr_out = tiledp + (j * (OPJ_SIZE_T)tile_w);
 1807|       |            for (i = 0; i < cblk_w / 16; ++i) {
 1808|       |                __m512i in_avx = _mm512_loadu_si512((__m512i*)(ptr_in));
 1809|       |                const __m512i add_avx = _mm512_srli_epi32(in_avx, 31);
 1810|       |                in_avx = _mm512_add_epi32(in_avx, add_avx);
 1811|       |                _mm512_storeu_si512((__m512i*)(ptr_out), _mm512_srai_epi32(in_avx, 1));
 1812|       |                ptr_in += 16;
 1813|       |                ptr_out += 16;
 1814|       |            }
 1815|       |
 1816|       |            for (i = 0; i < cblk_w % 16; ++i) {
 1817|       |                ptr_out[i] = ptr_in[i] / 2;
 1818|       |            }
 1819|       |#elif defined(__AVX2__)
 1820|       |            OPJ_INT32* ptr_in = datap + (j * cblk_w);
 1821|       |            OPJ_INT32* ptr_out = tiledp + (j * (OPJ_SIZE_T)tile_w);
 1822|       |            for (i = 0; i < cblk_w / 8; ++i) {
 1823|       |                __m256i in_avx = _mm256_loadu_si256((__m256i*)(ptr_in));
 1824|       |                const __m256i add_avx = _mm256_srli_epi32(in_avx, 31);
 1825|       |                in_avx = _mm256_add_epi32(in_avx, add_avx);
 1826|       |                _mm256_storeu_si256((__m256i*)(ptr_out), _mm256_srai_epi32(in_avx, 1));
 1827|       |                ptr_in += 8;
 1828|       |                ptr_out += 8;
 1829|       |            }
 1830|       |
 1831|       |            for (i = 0; i < cblk_w % 8; ++i) {
 1832|       |                ptr_out[i] = ptr_in[i] / 2;
 1833|       |            }
 1834|       |#else
 1835|  3.09M|            i = 0;
 1836|  23.5M|            for (; i < (cblk_w & ~(OPJ_UINT32)3U); i += 4U) {
  ------------------
  |  Branch (1836:20): [True: 20.4M, False: 3.09M]
  ------------------
 1837|  20.4M|                OPJ_INT32 tmp0 = datap[(j * cblk_w) + i + 0U];
 1838|  20.4M|                OPJ_INT32 tmp1 = datap[(j * cblk_w) + i + 1U];
 1839|  20.4M|                OPJ_INT32 tmp2 = datap[(j * cblk_w) + i + 2U];
 1840|  20.4M|                OPJ_INT32 tmp3 = datap[(j * cblk_w) + i + 3U];
 1841|  20.4M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 0U] = tmp0 / 2;
 1842|  20.4M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 1U] = tmp1 / 2;
 1843|  20.4M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 2U] = tmp2 / 2;
 1844|  20.4M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 3U] = tmp3 / 2;
 1845|  20.4M|            }
 1846|  4.84M|            for (; i < cblk_w; ++i) {
  ------------------
  |  Branch (1846:20): [True: 1.74M, False: 3.09M]
  ------------------
 1847|  1.74M|                OPJ_INT32 tmp = datap[(j * cblk_w) + i];
 1848|  1.74M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i] = tmp / 2;
 1849|  1.74M|            }
 1850|  3.09M|#endif
 1851|  3.09M|        }
 1852|   658k|    } else {        /* if (tccp->qmfbid == 0) */
 1853|   658k|        const float stepsize = 0.5f * band->stepsize;
 1854|   658k|        OPJ_FLOAT32* OPJ_RESTRICT tiledp = (OPJ_FLOAT32*) &tilec->data[(OPJ_SIZE_T)y *
 1855|   658k|                                                         tile_w + (OPJ_SIZE_T)x];
 1856|  3.29M|        for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1856:21): [True: 2.63M, False: 658k]
  ------------------
 1857|  2.63M|            OPJ_FLOAT32* OPJ_RESTRICT tiledp2 = tiledp;
 1858|  20.1M|            for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1858:25): [True: 17.4M, False: 2.63M]
  ------------------
 1859|  17.4M|                OPJ_FLOAT32 tmp = (OPJ_FLOAT32) * datap * stepsize;
 1860|  17.4M|                *tiledp2 = tmp;
 1861|  17.4M|                datap++;
 1862|  17.4M|                tiledp2++;
 1863|  17.4M|            }
 1864|  2.63M|            tiledp += tile_w;
 1865|  2.63M|        }
 1866|   658k|    }
 1867|       |
 1868|  1.34M|    opj_free(job);
 1869|  1.34M|}
t1.c:opj_t1_destroy_wrapper:
 1606|  1.87k|{
 1607|  1.87k|    opj_t1_destroy((opj_t1_t*) t1);
 1608|  1.87k|}
t1.c:opj_t1_decode_cblk:
 2006|  1.28M|{
 2007|  1.28M|    opj_mqc_t *mqc = &(t1->mqc);   /* MQC component */
 2008|       |
 2009|  1.28M|    OPJ_INT32 bpno_plus_one;
 2010|  1.28M|    OPJ_UINT32 passtype;
 2011|  1.28M|    OPJ_UINT32 segno, passno;
 2012|  1.28M|    OPJ_BYTE* cblkdata = NULL;
 2013|  1.28M|    OPJ_UINT32 cblkdataindex = 0;
 2014|  1.28M|    OPJ_BYTE type = T1_TYPE_MQ; /* BYPASS mode */
  ------------------
  |  |   70|  1.28M|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
 2015|  1.28M|    OPJ_INT32* original_t1_data = NULL;
 2016|       |
 2017|  1.28M|    mqc->lut_ctxno_zc_orient = lut_ctxno_zc + (orient << 9);
 2018|       |
 2019|  1.28M|    if (!opj_t1_allocate_buffers(
  ------------------
  |  Branch (2019:9): [True: 0, False: 1.28M]
  ------------------
 2020|  1.28M|                t1,
 2021|  1.28M|                (OPJ_UINT32)(cblk->x1 - cblk->x0),
 2022|  1.28M|                (OPJ_UINT32)(cblk->y1 - cblk->y0))) {
 2023|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2024|      0|    }
 2025|       |
 2026|  1.28M|    bpno_plus_one = (OPJ_INT32)(roishift + cblk->numbps);
 2027|  1.28M|    if (bpno_plus_one >= 31) {
  ------------------
  |  Branch (2027:9): [True: 5, False: 1.28M]
  ------------------
 2028|      5|        if (p_manager_mutex) {
  ------------------
  |  Branch (2028:13): [True: 5, False: 0]
  ------------------
 2029|      5|            opj_mutex_lock(p_manager_mutex);
 2030|      5|        }
 2031|      5|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      5|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2032|      5|                      "opj_t1_decode_cblk(): unsupported bpno_plus_one = %d >= 31\n",
 2033|      5|                      bpno_plus_one);
 2034|      5|        if (p_manager_mutex) {
  ------------------
  |  Branch (2034:13): [True: 5, False: 0]
  ------------------
 2035|      5|            opj_mutex_unlock(p_manager_mutex);
 2036|      5|        }
 2037|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 2038|      5|    }
 2039|  1.28M|    passtype = 2;
 2040|       |
 2041|  1.28M|    opj_mqc_resetstates(mqc);
 2042|  1.28M|    opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46);
  ------------------
  |  |   65|  1.28M|#define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   64|  1.28M|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|  1.28M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|  1.28M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   61|  1.28M|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   55|  1.28M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|  1.28M|#define T1_NUMCTXS_SC  5
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  1.28M|#define T1_NUMCTXS_MAG 3
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   58|  1.28M|#define T1_NUMCTXS_AGG 1
  |  |  ------------------
  ------------------
 2043|  1.28M|    opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
  ------------------
  |  |   64|  1.28M|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   63|  1.28M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  1.28M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   61|  1.28M|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.28M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  1.28M|#define T1_NUMCTXS_SC  5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   57|  1.28M|#define T1_NUMCTXS_MAG 3
  |  |  ------------------
  ------------------
 2044|  1.28M|    opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
  ------------------
  |  |   61|  1.28M|#define T1_CTXNO_ZC  0
  ------------------
 2045|       |
 2046|  1.28M|    if (cblk->corrupted) {
  ------------------
  |  Branch (2046:9): [True: 0, False: 1.28M]
  ------------------
 2047|      0|        assert(cblk->numchunks == 0);
 2048|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 2049|      0|    }
 2050|       |
 2051|       |    /* Even if we have a single chunk, in multi-threaded decoding */
 2052|       |    /* the insertion of our synthetic marker might potentially override */
 2053|       |    /* valid codestream of other codeblocks decoded in parallel. */
 2054|  1.28M|    if (cblk->numchunks > 1 || (t1->mustuse_cblkdatabuffer &&
  ------------------
  |  Branch (2054:9): [True: 3.92k, False: 1.27M]
  |  Branch (2054:33): [True: 0, False: 1.27M]
  ------------------
 2055|  1.27M|                                cblk->numchunks > 0)) {
  ------------------
  |  Branch (2055:33): [True: 0, False: 0]
  ------------------
 2056|  3.92k|        OPJ_UINT32 i;
 2057|  3.92k|        OPJ_UINT32 cblk_len;
 2058|       |
 2059|       |        /* Compute whole codeblock length from chunk lengths */
 2060|  3.92k|        cblk_len = 0;
 2061|  33.7k|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (2061:21): [True: 29.8k, False: 3.92k]
  ------------------
 2062|  29.8k|            cblk_len += cblk->chunks[i].len;
 2063|  29.8k|        }
 2064|       |
 2065|       |        /* Allocate temporary memory if needed */
 2066|  3.92k|        if (cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA > t1->cblkdatabuffersize) {
  ------------------
  |  |   39|  3.92k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  |  Branch (2066:13): [True: 338, False: 3.58k]
  ------------------
 2067|    338|            cblkdata = (OPJ_BYTE*)opj_realloc(t1->cblkdatabuffer,
 2068|    338|                                              cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|    338|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2069|    338|            if (cblkdata == NULL) {
  ------------------
  |  Branch (2069:17): [True: 0, False: 338]
  ------------------
 2070|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2071|      0|            }
 2072|    338|            t1->cblkdatabuffer = cblkdata;
 2073|    338|            memset(t1->cblkdatabuffer + cblk_len, 0, OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|    338|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2074|    338|            t1->cblkdatabuffersize = cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA;
  ------------------
  |  |   39|    338|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2075|    338|        }
 2076|       |
 2077|       |        /* Concatenate all chunks */
 2078|  3.92k|        cblkdata = t1->cblkdatabuffer;
 2079|  3.92k|        cblk_len = 0;
 2080|  33.7k|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (2080:21): [True: 29.8k, False: 3.92k]
  ------------------
 2081|  29.8k|            memcpy(cblkdata + cblk_len, cblk->chunks[i].data, cblk->chunks[i].len);
 2082|  29.8k|            cblk_len += cblk->chunks[i].len;
 2083|  29.8k|        }
 2084|  1.27M|    } else if (cblk->numchunks == 1) {
  ------------------
  |  Branch (2084:16): [True: 8.04k, False: 1.26M]
  ------------------
 2085|  8.04k|        cblkdata = cblk->chunks[0].data;
 2086|  1.26M|    } else {
 2087|       |        /* Not sure if that can happen in practice, but avoid Coverity to */
 2088|       |        /* think we will dereference a null cblkdta pointer */
 2089|  1.26M|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.26M|#define OPJ_TRUE 1
  ------------------
 2090|  1.26M|    }
 2091|       |
 2092|       |    /* For subtile decoding, directly decode in the decoded_data buffer of */
 2093|       |    /* the code-block. Hack t1->data to point to it, and restore it later */
 2094|  11.9k|    if (cblk->decoded_data) {
  ------------------
  |  Branch (2094:9): [True: 832, False: 11.1k]
  ------------------
 2095|    832|        original_t1_data = t1->data;
 2096|    832|        t1->data = cblk->decoded_data;
 2097|    832|    }
 2098|       |
 2099|  30.7k|    for (segno = 0; segno < cblk->real_num_segs; ++segno) {
  ------------------
  |  Branch (2099:21): [True: 18.7k, False: 11.9k]
  ------------------
 2100|  18.7k|        opj_tcd_seg_t *seg = &cblk->segs[segno];
 2101|       |
 2102|       |        /* BYPASS mode */
 2103|  18.7k|        type = ((bpno_plus_one <= ((OPJ_INT32)(cblk->numbps)) - 4) && (passtype < 2) &&
  ------------------
  |  Branch (2103:17): [True: 3.02k, False: 15.7k]
  |  Branch (2103:71): [True: 2.05k, False: 978]
  ------------------
 2104|  18.7k|                (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
  ------------------
  |  |   58|  2.05k|#define J2K_CCP_CBLKSTY_LAZY 0x01     /**< Selective arithmetic coding bypass */
  ------------------
                              (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
  ------------------
  |  |   71|  1.57k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
                              (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
  ------------------
  |  |   70|  35.9k|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
  |  Branch (2104:17): [True: 1.57k, False: 471]
  ------------------
 2105|       |
 2106|  18.7k|        if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|  18.7k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2106:13): [True: 1.57k, False: 17.1k]
  ------------------
 2107|  1.57k|            opj_mqc_raw_init_dec(mqc, cblkdata + cblkdataindex, seg->len,
 2108|  1.57k|                                 OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  1.57k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2109|  17.1k|        } else {
 2110|  17.1k|            opj_mqc_init_dec(mqc, cblkdata + cblkdataindex, seg->len,
 2111|  17.1k|                             OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  17.1k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2112|  17.1k|        }
 2113|  18.7k|        cblkdataindex += seg->len;
 2114|       |
 2115|   111k|        for (passno = 0; (passno < seg->real_num_passes) &&
  ------------------
  |  Branch (2115:26): [True: 96.7k, False: 14.2k]
  ------------------
 2116|   111k|                (bpno_plus_one >= 1); ++passno) {
  ------------------
  |  Branch (2116:17): [True: 92.2k, False: 4.53k]
  ------------------
 2117|  92.2k|            switch (passtype) {
  ------------------
  |  Branch (2117:21): [True: 0, False: 92.2k]
  ------------------
 2118|  28.6k|            case 0:
  ------------------
  |  Branch (2118:13): [True: 28.6k, False: 63.5k]
  ------------------
 2119|  28.6k|                if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|  28.6k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2119:21): [True: 961, False: 27.6k]
  ------------------
 2120|    961|                    opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2121|  27.6k|                } else {
 2122|  27.6k|                    opj_t1_dec_sigpass_mqc(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2123|  27.6k|                }
 2124|  28.6k|                break;
 2125|  26.5k|            case 1:
  ------------------
  |  Branch (2125:13): [True: 26.5k, False: 65.6k]
  ------------------
 2126|  26.5k|                if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|  26.5k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2126:21): [True: 934, False: 25.6k]
  ------------------
 2127|    934|                    opj_t1_dec_refpass_raw(t1, bpno_plus_one);
 2128|  25.6k|                } else {
 2129|  25.6k|                    opj_t1_dec_refpass_mqc(t1, bpno_plus_one);
 2130|  25.6k|                }
 2131|  26.5k|                break;
 2132|  37.0k|            case 2:
  ------------------
  |  Branch (2132:13): [True: 37.0k, False: 55.2k]
  ------------------
 2133|  37.0k|                opj_t1_dec_clnpass(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2134|  37.0k|                break;
 2135|  92.2k|            }
 2136|       |
 2137|  92.2k|            if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) {
  ------------------
  |  |   59|  92.2k|#define J2K_CCP_CBLKSTY_RESET 0x02    /**< Reset context probabilities on coding pass boundaries */
  ------------------
                          if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) {
  ------------------
  |  |   70|  20.4k|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
  |  Branch (2137:17): [True: 20.4k, False: 71.7k]
  |  Branch (2137:54): [True: 19.6k, False: 857]
  ------------------
 2138|  19.6k|                opj_mqc_resetstates(mqc);
 2139|  19.6k|                opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46);
  ------------------
  |  |   65|  19.6k|#define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   64|  19.6k|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|  19.6k|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|  19.6k|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   61|  19.6k|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   55|  19.6k|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|  19.6k|#define T1_NUMCTXS_SC  5
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  19.6k|#define T1_NUMCTXS_MAG 3
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   58|  19.6k|#define T1_NUMCTXS_AGG 1
  |  |  ------------------
  ------------------
 2140|  19.6k|                opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
  ------------------
  |  |   64|  19.6k|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   63|  19.6k|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  19.6k|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   61|  19.6k|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  19.6k|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  19.6k|#define T1_NUMCTXS_SC  5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   57|  19.6k|#define T1_NUMCTXS_MAG 3
  |  |  ------------------
  ------------------
 2141|  19.6k|                opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
  ------------------
  |  |   61|  19.6k|#define T1_CTXNO_ZC  0
  ------------------
 2142|  19.6k|            }
 2143|  92.2k|            if (++passtype == 3) {
  ------------------
  |  Branch (2143:17): [True: 37.0k, False: 55.2k]
  ------------------
 2144|  37.0k|                passtype = 0;
 2145|  37.0k|                bpno_plus_one--;
 2146|  37.0k|            }
 2147|  92.2k|        }
 2148|       |
 2149|  18.7k|        opq_mqc_finish_dec(mqc);
 2150|  18.7k|    }
 2151|       |
 2152|  11.9k|    if (check_pterm) {
  ------------------
  |  Branch (2152:9): [True: 9.05k, False: 2.91k]
  ------------------
 2153|  9.05k|        if (mqc->bp + 2 < mqc->end) {
  ------------------
  |  Branch (2153:13): [True: 512, False: 8.53k]
  ------------------
 2154|    512|            if (p_manager_mutex) {
  ------------------
  |  Branch (2154:17): [True: 512, False: 0]
  ------------------
 2155|    512|                opj_mutex_lock(p_manager_mutex);
 2156|    512|            }
 2157|    512|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    512|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2158|    512|                          "PTERM check failure: %d remaining bytes in code block (%d used / %d)\n",
 2159|    512|                          (int)(mqc->end - mqc->bp) - 2,
 2160|    512|                          (int)(mqc->bp - mqc->start),
 2161|    512|                          (int)(mqc->end - mqc->start));
 2162|    512|            if (p_manager_mutex) {
  ------------------
  |  Branch (2162:17): [True: 512, False: 0]
  ------------------
 2163|    512|                opj_mutex_unlock(p_manager_mutex);
 2164|    512|            }
 2165|  8.53k|        } else if (mqc->end_of_byte_stream_counter > 2) {
  ------------------
  |  Branch (2165:20): [True: 7.13k, False: 1.40k]
  ------------------
 2166|  7.13k|            if (p_manager_mutex) {
  ------------------
  |  Branch (2166:17): [True: 7.13k, False: 0]
  ------------------
 2167|  7.13k|                opj_mutex_lock(p_manager_mutex);
 2168|  7.13k|            }
 2169|  7.13k|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  7.13k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2170|  7.13k|                          "PTERM check failure: %d synthesized 0xFF markers read\n",
 2171|  7.13k|                          mqc->end_of_byte_stream_counter);
 2172|  7.13k|            if (p_manager_mutex) {
  ------------------
  |  Branch (2172:17): [True: 7.13k, False: 0]
  ------------------
 2173|  7.13k|                opj_mutex_unlock(p_manager_mutex);
 2174|  7.13k|            }
 2175|  7.13k|        }
 2176|  9.05k|    }
 2177|       |
 2178|       |    /* Restore original t1->data is needed */
 2179|  11.9k|    if (cblk->decoded_data) {
  ------------------
  |  Branch (2179:9): [True: 832, False: 11.1k]
  ------------------
 2180|    832|        t1->data = original_t1_data;
 2181|    832|    }
 2182|       |
 2183|  11.9k|    return OPJ_TRUE;
  ------------------
  |  |  117|  11.9k|#define OPJ_TRUE 1
  ------------------
 2184|  11.9k|}
t1.c:opj_t1_allocate_buffers:
 1455|  1.28M|{
 1456|  1.28M|    OPJ_UINT32 flagssize;
 1457|  1.28M|    OPJ_UINT32 flags_stride;
 1458|       |
 1459|       |    /* No risk of overflow. Prior checks ensure those assert are met */
 1460|       |    /* They are per the specification */
 1461|  1.28M|    assert(w <= 1024);
 1462|  1.28M|    assert(h <= 1024);
 1463|  1.28M|    assert(w * h <= 4096);
 1464|       |
 1465|       |    /* encoder uses tile buffer, so no need to allocate */
 1466|  1.28M|    {
 1467|  1.28M|        OPJ_UINT32 datasize = w * h;
 1468|       |
 1469|  1.28M|        if (datasize > t1->datasize) {
  ------------------
  |  Branch (1469:13): [True: 6.77k, False: 1.27M]
  ------------------
 1470|  6.77k|            opj_aligned_free(t1->data);
 1471|  6.77k|            t1->data = (OPJ_INT32*) opj_aligned_malloc(datasize * sizeof(OPJ_INT32));
 1472|  6.77k|            if (!t1->data) {
  ------------------
  |  Branch (1472:17): [True: 0, False: 6.77k]
  ------------------
 1473|       |                /* FIXME event manager error callback */
 1474|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1475|      0|            }
 1476|  6.77k|            t1->datasize = datasize;
 1477|  6.77k|        }
 1478|       |        /* memset first arg is declared to never be null by gcc */
 1479|  1.28M|        if (t1->data != NULL) {
  ------------------
  |  Branch (1479:13): [True: 1.28M, False: 60]
  ------------------
 1480|  1.28M|            memset(t1->data, 0, datasize * sizeof(OPJ_INT32));
 1481|  1.28M|        }
 1482|  1.28M|    }
 1483|       |
 1484|      0|    flags_stride = w + 2U; /* can't be 0U */
 1485|       |
 1486|  1.28M|    flagssize = (h + 3U) / 4U + 2U;
 1487|       |
 1488|  1.28M|    flagssize *= flags_stride;
 1489|  1.28M|    {
 1490|  1.28M|        opj_flag_t* p;
 1491|  1.28M|        OPJ_UINT32 x;
 1492|  1.28M|        OPJ_UINT32 flags_height = (h + 3U) / 4U;
 1493|       |
 1494|  1.28M|        if (flagssize > t1->flagssize) {
  ------------------
  |  Branch (1494:13): [True: 109k, False: 1.17M]
  ------------------
 1495|       |
 1496|   109k|            opj_aligned_free(t1->flags);
 1497|   109k|            t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof(
 1498|   109k|                            opj_flag_t));
 1499|   109k|            if (!t1->flags) {
  ------------------
  |  Branch (1499:17): [True: 0, False: 109k]
  ------------------
 1500|       |                /* FIXME event manager error callback */
 1501|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1502|      0|            }
 1503|   109k|        }
 1504|  1.28M|        t1->flagssize = flagssize;
 1505|       |
 1506|  1.28M|        memset(t1->flags, 0, flagssize * sizeof(opj_flag_t));
 1507|       |
 1508|  1.28M|        p = &t1->flags[0];
 1509|  28.3M|        for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1509:21): [True: 27.0M, False: 1.28M]
  ------------------
 1510|       |            /* magic value to hopefully stop any passes being interested in this entry */
 1511|  27.0M|            *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  115|  27.0M|#define T1_PI_0     (1U << 21)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  119|  27.0M|#define T1_PI_1     (1U << 24)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  122|  27.0M|#define T1_PI_2     (1U << 27)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  125|  27.0M|#define T1_PI_3     (1U << 30)
  ------------------
 1512|  27.0M|        }
 1513|       |
 1514|  1.28M|        p = &t1->flags[((flags_height + 1) * flags_stride)];
 1515|  28.3M|        for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1515:21): [True: 27.0M, False: 1.28M]
  ------------------
 1516|       |            /* magic value to hopefully stop any passes being interested in this entry */
 1517|  27.0M|            *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  115|  27.0M|#define T1_PI_0     (1U << 21)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  119|  27.0M|#define T1_PI_1     (1U << 24)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  122|  27.0M|#define T1_PI_2     (1U << 27)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  125|  27.0M|#define T1_PI_3     (1U << 30)
  ------------------
 1518|  27.0M|        }
 1519|       |
 1520|  1.28M|        if (h % 4) {
  ------------------
  |  Branch (1520:13): [True: 268k, False: 1.01M]
  ------------------
 1521|   268k|            OPJ_UINT32 v = 0;
 1522|   268k|            p = &t1->flags[((flags_height) * flags_stride)];
 1523|   268k|            if (h % 4 == 1) {
  ------------------
  |  Branch (1523:17): [True: 137k, False: 130k]
  ------------------
 1524|   137k|                v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  119|   137k|#define T1_PI_1     (1U << 24)
  ------------------
                              v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  122|   137k|#define T1_PI_2     (1U << 27)
  ------------------
                              v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  125|   137k|#define T1_PI_3     (1U << 30)
  ------------------
 1525|   137k|            } else if (h % 4 == 2) {
  ------------------
  |  Branch (1525:24): [True: 71.0k, False: 59.6k]
  ------------------
 1526|  71.0k|                v |= T1_PI_2 | T1_PI_3;
  ------------------
  |  |  122|  71.0k|#define T1_PI_2     (1U << 27)
  ------------------
                              v |= T1_PI_2 | T1_PI_3;
  ------------------
  |  |  125|  71.0k|#define T1_PI_3     (1U << 30)
  ------------------
 1527|  71.0k|            } else if (h % 4 == 3) {
  ------------------
  |  Branch (1527:24): [True: 59.6k, False: 0]
  ------------------
 1528|  59.6k|                v |= T1_PI_3;
  ------------------
  |  |  125|  59.6k|#define T1_PI_3     (1U << 30)
  ------------------
 1529|  59.6k|            }
 1530|  4.71M|            for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1530:25): [True: 4.44M, False: 268k]
  ------------------
 1531|  4.44M|                *p++ = v;
 1532|  4.44M|            }
 1533|   268k|        }
 1534|  1.28M|    }
 1535|       |
 1536|      0|    t1->w = w;
 1537|  1.28M|    t1->h = h;
 1538|       |
 1539|  1.28M|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.28M|#define OPJ_TRUE 1
  ------------------
 1540|  1.28M|}
t1.c:opj_t1_dec_sigpass_raw:
  586|    961|{
  587|    961|    OPJ_INT32 one, half, oneplushalf;
  588|    961|    OPJ_UINT32 i, j, k;
  589|    961|    OPJ_INT32 *data = t1->data;
  590|    961|    opj_flag_t *flagsp = &T1_FLAGS(0, 0);
  ------------------
  |  |   63|    961|#define T1_FLAGS(x, y) (t1->flags[x + 1 + ((y / 4) + 1) * (t1->w+2)])
  ------------------
  591|    961|    const OPJ_UINT32 l_w = t1->w;
  592|    961|    one = 1 << bpno;
  593|    961|    half = one >> 1;
  594|    961|    oneplushalf = one | half;
  595|       |
  596|  4.96k|    for (k = 0; k < (t1->h & ~3U); k += 4, flagsp += 2, data += 3 * l_w) {
  ------------------
  |  Branch (596:17): [True: 3.99k, False: 961]
  ------------------
  597|   370k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) {
  ------------------
  |  Branch (597:21): [True: 366k, False: 3.99k]
  ------------------
  598|   366k|            opj_flag_t flags = *flagsp;
  599|   366k|            if (flags != 0) {
  ------------------
  |  Branch (599:17): [True: 303k, False: 62.5k]
  ------------------
  600|   303k|                opj_t1_dec_sigpass_step_raw(
  601|   303k|                    t1,
  602|   303k|                    flagsp,
  603|   303k|                    data,
  604|   303k|                    oneplushalf,
  605|   303k|                    cblksty & J2K_CCP_CBLKSTY_VSC, /* vsc */
  ------------------
  |  |   61|   303k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  606|   303k|                    0U);
  607|   303k|                opj_t1_dec_sigpass_step_raw(
  608|   303k|                    t1,
  609|   303k|                    flagsp,
  610|   303k|                    data + l_w,
  611|   303k|                    oneplushalf,
  612|   303k|                    OPJ_FALSE, /* vsc */
  ------------------
  |  |  118|   303k|#define OPJ_FALSE 0
  ------------------
  613|   303k|                    1U);
  614|   303k|                opj_t1_dec_sigpass_step_raw(
  615|   303k|                    t1,
  616|   303k|                    flagsp,
  617|   303k|                    data + 2 * l_w,
  618|   303k|                    oneplushalf,
  619|   303k|                    OPJ_FALSE, /* vsc */
  ------------------
  |  |  118|   303k|#define OPJ_FALSE 0
  ------------------
  620|   303k|                    2U);
  621|   303k|                opj_t1_dec_sigpass_step_raw(
  622|   303k|                    t1,
  623|   303k|                    flagsp,
  624|   303k|                    data + 3 * l_w,
  625|   303k|                    oneplushalf,
  626|   303k|                    OPJ_FALSE, /* vsc */
  ------------------
  |  |  118|   303k|#define OPJ_FALSE 0
  ------------------
  627|   303k|                    3U);
  628|   303k|            }
  629|   366k|        }
  630|  3.99k|    }
  631|    961|    if (k < t1->h) {
  ------------------
  |  Branch (631:9): [True: 431, False: 530]
  ------------------
  632|  90.0k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) {
  ------------------
  |  Branch (632:21): [True: 89.5k, False: 431]
  ------------------
  633|   281k|            for (j = 0; j < t1->h - k; ++j) {
  ------------------
  |  Branch (633:25): [True: 192k, False: 89.5k]
  ------------------
  634|   192k|                opj_t1_dec_sigpass_step_raw(
  635|   192k|                    t1,
  636|   192k|                    flagsp,
  637|   192k|                    data + j * l_w,
  638|   192k|                    oneplushalf,
  639|   192k|                    cblksty & J2K_CCP_CBLKSTY_VSC, /* vsc */
  ------------------
  |  |   61|   192k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  640|   192k|                    j);
  641|   192k|            }
  642|  89.5k|        }
  643|    431|    }
  644|    961|}
t1.c:opj_t1_dec_sigpass_step_raw:
  419|  1.40M|{
  420|  1.40M|    OPJ_UINT32 v;
  421|  1.40M|    opj_mqc_t *mqc = &(t1->mqc);       /* RAW component */
  422|       |
  423|  1.40M|    OPJ_UINT32 const flags = *flagsp;
  424|       |
  425|  1.40M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U &&
  ------------------
  |  |  153|  1.40M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  ------------------
  |  |  |  |   95|  1.40M|#define T1_SIGMA_4  (1U << 4)
  |  |  ------------------
  ------------------
                  if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U &&
  ------------------
  |  |  163|  1.40M|#define T1_PI_THIS    T1_PI_0
  |  |  ------------------
  |  |  |  |  115|  1.40M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  ------------------
  |  Branch (425:9): [True: 108k, False: 1.29M]
  ------------------
  426|  1.40M|            (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) {
  ------------------
  |  |  158|   108k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  149|   108k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|   108k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  150|   108k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|   108k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  151|   108k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|   108k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  152|   108k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|   108k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  154|   108k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|   108k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  155|   108k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|   108k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  156|   108k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|   108k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  157|   108k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|   108k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (426:13): [True: 94.6k, False: 13.4k]
  ------------------
  427|  94.6k|        if (opj_mqc_raw_decode(mqc)) {
  ------------------
  |  Branch (427:13): [True: 86.4k, False: 8.22k]
  ------------------
  428|  86.4k|            v = opj_mqc_raw_decode(mqc);
  429|  86.4k|            *datap = v ? -oneplushalf : oneplushalf;
  ------------------
  |  Branch (429:22): [True: 85.0k, False: 1.33k]
  ------------------
  430|  86.4k|            opj_t1_update_flags(flagsp, ci, v, t1->w + 2, vsc);
  431|  86.4k|        }
  432|  94.6k|        *flagsp |= T1_PI_THIS << (ci * 3U);
  ------------------
  |  |  163|  94.6k|#define T1_PI_THIS    T1_PI_0
  |  |  ------------------
  |  |  |  |  115|  94.6k|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  ------------------
  433|  94.6k|    }
  434|  1.40M|}
t1.c:opj_t1_update_flags:
  356|  86.4k|{
  357|  86.4k|    opj_t1_update_flags_macro(*flagsp, flagsp, ci, s, stride, vsc);
  ------------------
  |  |  324|  86.4k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  325|  86.4k|{ \
  |  |  326|  86.4k|    /* east */ \
  |  |  327|  86.4k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  ------------------
  |  |  |  |   96|  86.4k|#define T1_SIGMA_5  (1U << 5)
  |  |  ------------------
  |  |  328|  86.4k| \
  |  |  329|  86.4k|    /* mark target as significant */ \
  |  |  330|  86.4k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  ------------------
  |  |  |  |  113|  86.4k|#define T1_CHI_1_I  19
  |  |  ------------------
  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  ------------------
  |  |  |  |   95|  86.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  ------------------
  |  |  331|  86.4k| \
  |  |  332|  86.4k|    /* west */ \
  |  |  333|  86.4k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  ------------------
  |  |  |  |   94|  86.4k|#define T1_SIGMA_3  (1U << 3)
  |  |  ------------------
  |  |  334|  86.4k| \
  |  |  335|  86.4k|    /* north-west, north, north-east */ \
  |  |  336|  86.4k|    if (ci == 0U && !(vsc)) { \
  |  |  ------------------
  |  |  |  Branch (336:9): [True: 24.0k, False: 62.3k]
  |  |  |  Branch (336:21): [True: 7.17k, False: 16.8k]
  |  |  ------------------
  |  |  337|  7.17k|        opj_flag_t* north = flagsp - (stride); \
  |  |  338|  7.17k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  ------------------
  |  |  |  |  127|  7.17k|#define T1_CHI_5_I  31
  |  |  ------------------
  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  ------------------
  |  |  |  |  107|  7.17k|#define T1_SIGMA_16 (1U << 16)
  |  |  ------------------
  |  |  339|  7.17k|        north[-1] |= T1_SIGMA_17; \
  |  |  ------------------
  |  |  |  |  108|  7.17k|#define T1_SIGMA_17 (1U << 17)
  |  |  ------------------
  |  |  340|  7.17k|        north[1] |= T1_SIGMA_15; \
  |  |  ------------------
  |  |  |  |  106|  7.17k|#define T1_SIGMA_15 (1U << 15)
  |  |  ------------------
  |  |  341|  7.17k|    } \
  |  |  342|  86.4k| \
  |  |  343|  86.4k|    /* south-west, south, south-east */ \
  |  |  344|  86.4k|    if (ci == 3U) { \
  |  |  ------------------
  |  |  |  Branch (344:9): [True: 19.0k, False: 67.3k]
  |  |  ------------------
  |  |  345|  19.0k|        opj_flag_t* south = flagsp + (stride); \
  |  |  346|  19.0k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  ------------------
  |  |  |  |  111|  19.0k|#define T1_CHI_0_I  18
  |  |  ------------------
  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  ------------------
  |  |  |  |   92|  19.0k|#define T1_SIGMA_1  (1U << 1)
  |  |  ------------------
  |  |  347|  19.0k|        south[-1] |= T1_SIGMA_2; \
  |  |  ------------------
  |  |  |  |   93|  19.0k|#define T1_SIGMA_2  (1U << 2)
  |  |  ------------------
  |  |  348|  19.0k|        south[1] |= T1_SIGMA_0; \
  |  |  ------------------
  |  |  |  |   91|  19.0k|#define T1_SIGMA_0  (1U << 0)
  |  |  ------------------
  |  |  349|  19.0k|    } \
  |  |  350|  86.4k|}
  ------------------
  358|  86.4k|}
t1.c:opj_t1_dec_sigpass_mqc:
  724|  27.6k|{
  725|  27.6k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (725:9): [True: 8.60k, False: 19.0k]
  |  Branch (725:24): [True: 7.62k, False: 976]
  ------------------
  726|  7.62k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|  7.62k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (726:13): [True: 2.06k, False: 5.55k]
  ------------------
  727|  2.06k|            opj_t1_dec_sigpass_mqc_64x64_vsc(t1, bpno);
  728|  5.55k|        } else {
  729|  5.55k|            opj_t1_dec_sigpass_mqc_64x64_novsc(t1, bpno);
  730|  5.55k|        }
  731|  20.0k|    } else {
  732|  20.0k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|  20.0k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (732:13): [True: 6.18k, False: 13.8k]
  ------------------
  733|  6.18k|            opj_t1_dec_sigpass_mqc_generic_vsc(t1, bpno);
  734|  13.8k|        } else {
  735|  13.8k|            opj_t1_dec_sigpass_mqc_generic_novsc(t1, bpno);
  736|  13.8k|        }
  737|  20.0k|    }
  738|  27.6k|}
t1.c:opj_t1_dec_sigpass_mqc_64x64_vsc:
  700|  2.06k|{
  701|  2.06k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_TRUE, 64, 64, 66);
  ------------------
  |  |  646|  2.06k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  647|  2.06k|{ \
  |  |  648|  2.06k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  649|  2.06k|        OPJ_UINT32 i, j, k; \
  |  |  650|  2.06k|        register OPJ_INT32 *data = t1->data; \
  |  |  651|  2.06k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  652|  2.06k|        const OPJ_UINT32 l_w = w; \
  |  |  653|  2.06k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  654|  2.06k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  2.06k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  2.06k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  2.06k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  2.06k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  655|  2.06k|        register OPJ_UINT32 v; \
  |  |  656|  2.06k|        one = 1 << bpno; \
  |  |  657|  2.06k|        half = one >> 1; \
  |  |  658|  2.06k|        oneplushalf = one | half; \
  |  |  659|  35.1k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (659:21): [True: 33.1k, False: 2.06k]
  |  |  ------------------
  |  |  660|  2.15M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (660:29): [True: 2.11M, False: 33.1k]
  |  |  ------------------
  |  |  661|  2.11M|                        opj_flag_t flags = *flagsp; \
  |  |  662|  2.11M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (662:29): [True: 1.81M, False: 299k]
  |  |  ------------------
  |  |  663|  1.81M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.81M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.81M|{ \
  |  |  |  |  440|  1.81M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.81M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.81M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.81M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.81M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 453k, False: 1.36M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.81M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   453k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   453k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   453k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   453k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   453k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   453k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   453k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   453k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   453k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   453k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   453k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   453k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   453k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   453k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   453k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   453k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   453k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 437k, False: 16.4k]
  |  |  |  |  ------------------
  |  |  |  |  442|   437k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   437k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   437k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   437k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   437k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   437k|{ \
  |  |  |  |  |  |  140|   437k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   437k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   437k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   437k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   437k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   437k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 110k, False: 326k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   110k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   110k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   110k|{ \
  |  |  |  |  |  |  |  |   57|   110k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 24.6k, False: 85.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  24.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  24.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  24.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  85.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  85.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  85.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  85.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  85.9k|    } \
  |  |  |  |  |  |  |  |   66|   110k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   110k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   110k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   110k|{ \
  |  |  |  |  |  |  |  |  128|   172k|    do { \
  |  |  |  |  |  |  |  |  129|   172k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 21.7k, False: 150k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  21.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  21.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  21.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  21.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  21.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  21.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  21.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  21.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 21.1k, False: 543]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  21.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 21.0k, False: 134]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  21.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  21.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  21.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  21.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    134|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    134|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    134|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    134|            } \
  |  |  |  |  |  |  |  |  |  |  118|  21.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    543|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    543|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    543|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    543|        } \
  |  |  |  |  |  |  |  |  |  |  123|  21.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  21.7k|        } \
  |  |  |  |  |  |  |  |  132|   172k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   172k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   172k|        ct--; \
  |  |  |  |  |  |  |  |  135|   172k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 61.5k, False: 110k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   110k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   326k|    } else {  \
  |  |  |  |  |  |  149|   326k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   326k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 115k, False: 210k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   115k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   115k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   115k|{ \
  |  |  |  |  |  |  |  |   45|   115k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 19.5k, False: 96.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  19.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  19.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  96.3k|    } else { \
  |  |  |  |  |  |  |  |   49|  96.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  96.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  96.3k|    } \
  |  |  |  |  |  |  |  |   52|   115k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   115k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   115k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   115k|{ \
  |  |  |  |  |  |  |  |  128|   125k|    do { \
  |  |  |  |  |  |  |  |  129|   125k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15.6k, False: 110k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  15.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  15.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  15.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  15.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  15.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  15.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  15.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  15.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 15.2k, False: 412]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.1k, False: 96]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     96|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     96|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     96|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     96|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    412|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    412|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    412|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    412|        } \
  |  |  |  |  |  |  |  |  |  |  123|  15.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  15.6k|        } \
  |  |  |  |  |  |  |  |  132|   125k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   125k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   125k|        ct--; \
  |  |  |  |  |  |  |  |  135|   125k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9.81k, False: 115k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   115k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   210k|        } else { \
  |  |  |  |  |  |  154|   210k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   210k|        } \
  |  |  |  |  |  |  156|   326k|    } \
  |  |  |  |  |  |  157|   437k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   437k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 222k, False: 215k]
  |  |  |  |  ------------------
  |  |  |  |  446|   222k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   222k|                                flags, \
  |  |  |  |  448|   222k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   222k|                                ci); \
  |  |  |  |  450|   222k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   222k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   222k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   222k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   222k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   222k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   222k|{ \
  |  |  |  |  |  |  140|   222k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   222k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   222k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   222k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   222k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   222k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 59.2k, False: 162k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  59.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  59.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  59.2k|{ \
  |  |  |  |  |  |  |  |   57|  59.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 13.8k, False: 45.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  13.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  13.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  13.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  45.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  45.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  45.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  45.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  45.4k|    } \
  |  |  |  |  |  |  |  |   66|  59.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  59.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  59.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  59.2k|{ \
  |  |  |  |  |  |  |  |  128|  90.8k|    do { \
  |  |  |  |  |  |  |  |  129|  90.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.6k, False: 79.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  11.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  11.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  11.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  11.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  11.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  11.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  11.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  11.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.1k, False: 551]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.9k, False: 126]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    126|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    126|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    126|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    126|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    551|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    551|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    551|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    551|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.6k|        } \
  |  |  |  |  |  |  |  |  132|  90.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  90.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  90.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  90.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 31.5k, False: 59.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  59.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   162k|    } else {  \
  |  |  |  |  |  |  149|   162k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   162k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 63.3k, False: 99.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  63.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  63.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  63.3k|{ \
  |  |  |  |  |  |  |  |   45|  63.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.8k, False: 51.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  51.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  51.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  51.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  51.4k|    } \
  |  |  |  |  |  |  |  |   52|  63.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  63.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  63.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  63.3k|{ \
  |  |  |  |  |  |  |  |  128|  68.4k|    do { \
  |  |  |  |  |  |  |  |  129|  68.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 8.88k, False: 59.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  8.88k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  8.88k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  8.88k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  8.88k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  8.88k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  8.88k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  8.88k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  8.88k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.99k, False: 889]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.99k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.91k, False: 86]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.91k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.91k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.91k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.91k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     86|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     86|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     86|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     86|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.99k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    889|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    889|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    889|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    889|        } \
  |  |  |  |  |  |  |  |  |  |  123|  8.88k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  8.88k|        } \
  |  |  |  |  |  |  |  |  132|  68.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  68.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  68.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  68.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.09k, False: 63.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  63.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  99.5k|        } else { \
  |  |  |  |  |  |  154|  99.5k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  99.5k|        } \
  |  |  |  |  |  |  156|   162k|    } \
  |  |  |  |  |  |  157|   222k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   222k|            v = v ^ spb; \
  |  |  |  |  455|   222k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 110k, False: 111k]
  |  |  |  |  ------------------
  |  |  |  |  456|   222k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   222k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   222k|{ \
  |  |  |  |  |  |  326|   222k|    /* east */ \
  |  |  |  |  |  |  327|   222k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   222k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   222k| \
  |  |  |  |  |  |  329|   222k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   222k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   222k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   222k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   222k| \
  |  |  |  |  |  |  332|   222k|    /* west */ \
  |  |  |  |  |  |  333|   222k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   222k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   222k| \
  |  |  |  |  |  |  335|   222k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   222k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   222k| \
  |  |  |  |  |  |  343|   222k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   222k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   222k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   222k|        } \
  |  |  |  |  458|   437k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   437k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   437k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   437k|    } \
  |  |  |  |  460|  1.81M|}
  |  |  ------------------
  |  |  664|  1.81M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  1.81M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  666|  1.81M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.81M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.81M|{ \
  |  |  |  |  440|  1.81M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.81M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.81M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.81M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.81M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 450k, False: 1.36M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.81M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   450k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   450k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   450k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   450k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   450k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   450k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   450k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   450k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   450k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   450k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   450k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   450k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   450k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   450k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   450k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   450k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   450k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 431k, False: 18.9k]
  |  |  |  |  ------------------
  |  |  |  |  442|   431k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   431k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   431k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   431k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   431k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   431k|{ \
  |  |  |  |  |  |  140|   431k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   431k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   431k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   431k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   431k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   431k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 114k, False: 317k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   114k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   114k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   114k|{ \
  |  |  |  |  |  |  |  |   57|   114k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 25.8k, False: 88.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  25.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  25.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  25.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  88.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  88.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  88.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  88.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  88.2k|    } \
  |  |  |  |  |  |  |  |   66|   114k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   114k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   114k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   114k|{ \
  |  |  |  |  |  |  |  |  128|   177k|    do { \
  |  |  |  |  |  |  |  |  129|   177k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 21.4k, False: 156k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  21.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  21.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  21.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  21.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  21.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  21.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  21.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  21.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 20.8k, False: 566]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  20.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 20.7k, False: 125]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  20.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  20.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  20.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  20.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    125|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    125|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    125|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    125|            } \
  |  |  |  |  |  |  |  |  |  |  118|  20.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    566|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    566|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    566|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    566|        } \
  |  |  |  |  |  |  |  |  |  |  123|  21.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  21.4k|        } \
  |  |  |  |  |  |  |  |  132|   177k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   177k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   177k|        ct--; \
  |  |  |  |  |  |  |  |  135|   177k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 63.8k, False: 114k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   114k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   317k|    } else {  \
  |  |  |  |  |  |  149|   317k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   317k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 114k, False: 202k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   114k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   114k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   114k|{ \
  |  |  |  |  |  |  |  |   45|   114k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 19.6k, False: 95.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  19.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  19.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  95.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  95.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  95.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  95.1k|    } \
  |  |  |  |  |  |  |  |   52|   114k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   114k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   114k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   114k|{ \
  |  |  |  |  |  |  |  |  128|   123k|    do { \
  |  |  |  |  |  |  |  |  129|   123k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.1k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 15.8k, False: 378]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.6k, False: 105]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    105|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    105|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    105|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    105|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    378|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    378|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    378|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    378|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.1k|        } \
  |  |  |  |  |  |  |  |  132|   123k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   123k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   123k|        ct--; \
  |  |  |  |  |  |  |  |  135|   123k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8.21k, False: 114k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   114k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   202k|        } else { \
  |  |  |  |  |  |  154|   202k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   202k|        } \
  |  |  |  |  |  |  156|   317k|    } \
  |  |  |  |  |  |  157|   431k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   431k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 221k, False: 210k]
  |  |  |  |  ------------------
  |  |  |  |  446|   221k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   221k|                                flags, \
  |  |  |  |  448|   221k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   221k|                                ci); \
  |  |  |  |  450|   221k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   221k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   221k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   221k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   221k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   221k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   221k|{ \
  |  |  |  |  |  |  140|   221k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   221k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   221k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   221k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   221k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   221k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 61.6k, False: 159k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  61.6k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  61.6k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  61.6k|{ \
  |  |  |  |  |  |  |  |   57|  61.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 12.2k, False: 49.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  12.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  12.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  12.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  49.3k|    } else { \
  |  |  |  |  |  |  |  |   62|  49.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  49.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  49.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  49.3k|    } \
  |  |  |  |  |  |  |  |   66|  61.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  61.6k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  61.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  61.6k|{ \
  |  |  |  |  |  |  |  |  128|  98.6k|    do { \
  |  |  |  |  |  |  |  |  129|  98.6k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.6k, False: 86.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  12.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  12.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  12.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  12.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  12.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  12.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  12.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  12.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.1k, False: 515]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.0k, False: 116]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    116|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    116|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    116|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    116|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    515|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    515|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    515|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    515|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.6k|        } \
  |  |  |  |  |  |  |  |  132|  98.6k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  98.6k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  98.6k|        ct--; \
  |  |  |  |  |  |  |  |  135|  98.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 36.9k, False: 61.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  61.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   159k|    } else {  \
  |  |  |  |  |  |  149|   159k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   159k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 59.7k, False: 99.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  59.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  59.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  59.7k|{ \
  |  |  |  |  |  |  |  |   45|  59.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 10.2k, False: 49.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  10.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  10.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  49.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  49.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  49.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  49.4k|    } \
  |  |  |  |  |  |  |  |   52|  59.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  59.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  59.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  59.7k|{ \
  |  |  |  |  |  |  |  |  128|  63.8k|    do { \
  |  |  |  |  |  |  |  |  129|  63.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 8.02k, False: 55.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  8.02k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  8.02k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  8.02k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  8.02k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  8.02k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  8.02k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  8.02k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  8.02k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.66k, False: 365]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.66k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.57k, False: 84]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.57k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.57k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.57k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.57k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     84|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     84|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     84|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     84|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.66k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    365|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    365|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    365|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    365|        } \
  |  |  |  |  |  |  |  |  |  |  123|  8.02k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  8.02k|        } \
  |  |  |  |  |  |  |  |  132|  63.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  63.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  63.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  63.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.17k, False: 59.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  59.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  99.8k|        } else { \
  |  |  |  |  |  |  154|  99.8k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  99.8k|        } \
  |  |  |  |  |  |  156|   159k|    } \
  |  |  |  |  |  |  157|   221k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   221k|            v = v ^ spb; \
  |  |  |  |  455|   221k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 109k, False: 111k]
  |  |  |  |  ------------------
  |  |  |  |  456|   221k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   221k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   221k|{ \
  |  |  |  |  |  |  326|   221k|    /* east */ \
  |  |  |  |  |  |  327|   221k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   221k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   221k| \
  |  |  |  |  |  |  329|   221k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   221k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   221k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   221k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   221k| \
  |  |  |  |  |  |  332|   221k|    /* west */ \
  |  |  |  |  |  |  333|   221k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   221k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   221k| \
  |  |  |  |  |  |  335|   221k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   221k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   221k| \
  |  |  |  |  |  |  343|   221k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   221k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   221k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   221k|        } \
  |  |  |  |  458|   431k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   431k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   431k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   431k|    } \
  |  |  |  |  460|  1.81M|}
  |  |  ------------------
  |  |  667|  1.81M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  1.81M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  1.81M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.81M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.81M|{ \
  |  |  |  |  440|  1.81M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.81M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.81M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.81M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.81M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 452k, False: 1.36M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.81M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   452k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   452k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   452k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   452k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   452k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   452k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   452k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   452k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   452k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   452k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   452k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   452k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   452k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   452k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   452k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   452k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   452k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 425k, False: 27.1k]
  |  |  |  |  ------------------
  |  |  |  |  442|   425k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   425k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   425k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   425k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   425k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   425k|{ \
  |  |  |  |  |  |  140|   425k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   425k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   425k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   425k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   425k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   425k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 110k, False: 314k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   110k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   110k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   110k|{ \
  |  |  |  |  |  |  |  |   57|   110k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 23.8k, False: 86.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  23.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  23.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  23.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  86.3k|    } else { \
  |  |  |  |  |  |  |  |   62|  86.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  86.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  86.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  86.3k|    } \
  |  |  |  |  |  |  |  |   66|   110k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   110k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   110k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   110k|{ \
  |  |  |  |  |  |  |  |  128|   172k|    do { \
  |  |  |  |  |  |  |  |  129|   172k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 22.2k, False: 150k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  22.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  22.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  22.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  22.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  22.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  22.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  22.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  22.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 21.4k, False: 796]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  21.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 21.3k, False: 138]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  21.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  21.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  21.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  21.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    138|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    138|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    138|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    138|            } \
  |  |  |  |  |  |  |  |  |  |  118|  21.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    796|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    796|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    796|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    796|        } \
  |  |  |  |  |  |  |  |  |  |  123|  22.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  22.2k|        } \
  |  |  |  |  |  |  |  |  132|   172k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   172k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   172k|        ct--; \
  |  |  |  |  |  |  |  |  135|   172k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 62.1k, False: 110k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   110k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   314k|    } else {  \
  |  |  |  |  |  |  149|   314k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   314k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 111k, False: 203k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   111k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   111k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   111k|{ \
  |  |  |  |  |  |  |  |   45|   111k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 20.2k, False: 91.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  20.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  20.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  91.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  91.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  91.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  91.0k|    } \
  |  |  |  |  |  |  |  |   52|   111k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   111k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   111k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   111k|{ \
  |  |  |  |  |  |  |  |  128|   120k|    do { \
  |  |  |  |  |  |  |  |  129|   120k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.9k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  13.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  13.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  13.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  13.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  13.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  13.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  13.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  13.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.5k, False: 346]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.4k, False: 95]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     95|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     95|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     95|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     95|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    346|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    346|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    346|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    346|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.9k|        } \
  |  |  |  |  |  |  |  |  132|   120k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   120k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   120k|        ct--; \
  |  |  |  |  |  |  |  |  135|   120k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9.06k, False: 111k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   111k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   203k|        } else { \
  |  |  |  |  |  |  154|   203k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   203k|        } \
  |  |  |  |  |  |  156|   314k|    } \
  |  |  |  |  |  |  157|   425k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   425k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 211k, False: 213k]
  |  |  |  |  ------------------
  |  |  |  |  446|   211k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   211k|                                flags, \
  |  |  |  |  448|   211k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   211k|                                ci); \
  |  |  |  |  450|   211k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   211k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   211k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   211k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   211k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   211k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   211k|{ \
  |  |  |  |  |  |  140|   211k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   211k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   211k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   211k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   211k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   211k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 54.9k, False: 156k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  54.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  54.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  54.9k|{ \
  |  |  |  |  |  |  |  |   57|  54.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 13.3k, False: 41.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  13.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  13.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  13.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  41.5k|    } else { \
  |  |  |  |  |  |  |  |   62|  41.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  41.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  41.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  41.5k|    } \
  |  |  |  |  |  |  |  |   66|  54.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  54.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  54.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  54.9k|{ \
  |  |  |  |  |  |  |  |  128|  85.0k|    do { \
  |  |  |  |  |  |  |  |  129|  85.0k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 10.1k, False: 74.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  10.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  10.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  10.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  10.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  10.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  10.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  10.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  10.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.65k, False: 470]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.65k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.54k, False: 115]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.54k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.54k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.54k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.54k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    115|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    115|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    115|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    115|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.65k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    470|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    470|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    470|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    470|        } \
  |  |  |  |  |  |  |  |  |  |  123|  10.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  10.1k|        } \
  |  |  |  |  |  |  |  |  132|  85.0k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  85.0k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  85.0k|        ct--; \
  |  |  |  |  |  |  |  |  135|  85.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 30.0k, False: 54.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  54.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   156k|    } else {  \
  |  |  |  |  |  |  149|   156k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   156k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 61.7k, False: 94.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  61.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  61.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  61.7k|{ \
  |  |  |  |  |  |  |  |   45|  61.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 9.96k, False: 51.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  9.96k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  9.96k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  51.8k|    } else { \
  |  |  |  |  |  |  |  |   49|  51.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  51.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  51.8k|    } \
  |  |  |  |  |  |  |  |   52|  61.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  61.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  61.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  61.7k|{ \
  |  |  |  |  |  |  |  |  128|  67.0k|    do { \
  |  |  |  |  |  |  |  |  129|  67.0k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 7.66k, False: 59.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  7.66k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  7.66k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  7.66k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  7.66k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  7.66k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  7.66k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  7.66k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  7.66k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.09k, False: 571]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.09k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.02k, False: 68]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.02k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.02k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.02k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.02k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     68|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     68|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     68|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     68|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.09k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    571|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    571|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    571|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    571|        } \
  |  |  |  |  |  |  |  |  |  |  123|  7.66k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  7.66k|        } \
  |  |  |  |  |  |  |  |  132|  67.0k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  67.0k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  67.0k|        ct--; \
  |  |  |  |  |  |  |  |  135|  67.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.30k, False: 61.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  61.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  94.8k|        } else { \
  |  |  |  |  |  |  154|  94.8k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  94.8k|        } \
  |  |  |  |  |  |  156|   156k|    } \
  |  |  |  |  |  |  157|   211k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   211k|            v = v ^ spb; \
  |  |  |  |  455|   211k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 106k, False: 105k]
  |  |  |  |  ------------------
  |  |  |  |  456|   211k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   211k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   211k|{ \
  |  |  |  |  |  |  326|   211k|    /* east */ \
  |  |  |  |  |  |  327|   211k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   211k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   211k| \
  |  |  |  |  |  |  329|   211k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   211k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   211k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   211k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   211k| \
  |  |  |  |  |  |  332|   211k|    /* west */ \
  |  |  |  |  |  |  333|   211k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   211k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   211k| \
  |  |  |  |  |  |  335|   211k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   211k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   211k| \
  |  |  |  |  |  |  343|   211k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   211k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   211k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   211k|        } \
  |  |  |  |  458|   425k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   425k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   425k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   425k|    } \
  |  |  |  |  460|  1.81M|}
  |  |  ------------------
  |  |  670|  1.81M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  1.81M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  1.81M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.81M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.81M|{ \
  |  |  |  |  440|  1.81M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.81M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.81M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.81M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.81M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 469k, False: 1.34M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.81M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   469k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   469k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   469k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   469k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   469k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   469k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   469k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   469k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   469k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   469k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   469k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   469k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   469k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   469k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   469k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   469k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   469k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 414k, False: 55.0k]
  |  |  |  |  ------------------
  |  |  |  |  442|   414k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   414k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   414k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   414k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   414k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   414k|{ \
  |  |  |  |  |  |  140|   414k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   414k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   414k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   414k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   414k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   414k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 107k, False: 307k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   107k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   107k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   107k|{ \
  |  |  |  |  |  |  |  |   57|   107k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 23.2k, False: 84.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  23.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  23.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  23.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  84.0k|    } else { \
  |  |  |  |  |  |  |  |   62|  84.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  84.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  84.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  84.0k|    } \
  |  |  |  |  |  |  |  |   66|   107k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   107k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   107k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   107k|{ \
  |  |  |  |  |  |  |  |  128|   168k|    do { \
  |  |  |  |  |  |  |  |  129|   168k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 21.7k, False: 146k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  21.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  21.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  21.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  21.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  21.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  21.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  21.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  21.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 21.2k, False: 502]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  21.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 21.0k, False: 142]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  21.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  21.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  21.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  21.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    142|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    142|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    142|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    142|            } \
  |  |  |  |  |  |  |  |  |  |  118|  21.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    502|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    502|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    502|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    502|        } \
  |  |  |  |  |  |  |  |  |  |  123|  21.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  21.7k|        } \
  |  |  |  |  |  |  |  |  132|   168k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   168k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   168k|        ct--; \
  |  |  |  |  |  |  |  |  135|   168k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 61.0k, False: 107k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   107k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   307k|    } else {  \
  |  |  |  |  |  |  149|   307k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   307k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 103k, False: 203k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   103k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   103k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   103k|{ \
  |  |  |  |  |  |  |  |   45|   103k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 18.3k, False: 85.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  18.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  18.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  85.3k|    } else { \
  |  |  |  |  |  |  |  |   49|  85.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  85.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  85.3k|    } \
  |  |  |  |  |  |  |  |   52|   103k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   103k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   103k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   103k|{ \
  |  |  |  |  |  |  |  |  128|   112k|    do { \
  |  |  |  |  |  |  |  |  129|   112k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15.0k, False: 97.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  15.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  15.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  15.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  15.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  15.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  15.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  15.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  15.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14.7k, False: 334]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  14.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.6k, False: 87]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  14.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  14.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  14.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  14.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     87|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     87|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     87|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     87|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    334|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    334|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    334|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    334|        } \
  |  |  |  |  |  |  |  |  |  |  123|  15.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  15.0k|        } \
  |  |  |  |  |  |  |  |  132|   112k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   112k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   112k|        ct--; \
  |  |  |  |  |  |  |  |  135|   112k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8.75k, False: 103k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   103k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   203k|        } else { \
  |  |  |  |  |  |  154|   203k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   203k|        } \
  |  |  |  |  |  |  156|   307k|    } \
  |  |  |  |  |  |  157|   414k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   414k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 217k, False: 196k]
  |  |  |  |  ------------------
  |  |  |  |  446|   217k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   217k|                                flags, \
  |  |  |  |  448|   217k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   217k|                                ci); \
  |  |  |  |  450|   217k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   217k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   217k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   217k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   217k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   217k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   217k|{ \
  |  |  |  |  |  |  140|   217k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   217k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   217k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   217k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   217k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   217k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 58.5k, False: 159k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  58.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  58.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  58.5k|{ \
  |  |  |  |  |  |  |  |   57|  58.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 13.8k, False: 44.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  13.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  13.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  13.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  44.6k|    } else { \
  |  |  |  |  |  |  |  |   62|  44.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  44.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  44.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  44.6k|    } \
  |  |  |  |  |  |  |  |   66|  58.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  58.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  58.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  58.5k|{ \
  |  |  |  |  |  |  |  |  128|  91.0k|    do { \
  |  |  |  |  |  |  |  |  129|  91.0k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.4k, False: 79.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  11.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  11.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  11.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  11.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  11.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  11.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  11.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  11.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.0k, False: 494]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.8k, False: 117]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    117|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    117|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    117|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    117|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    494|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    494|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    494|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    494|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.4k|        } \
  |  |  |  |  |  |  |  |  132|  91.0k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  91.0k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  91.0k|        ct--; \
  |  |  |  |  |  |  |  |  135|  91.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 32.5k, False: 58.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  58.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   159k|    } else {  \
  |  |  |  |  |  |  149|   159k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   159k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 62.0k, False: 97.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  62.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  62.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  62.0k|{ \
  |  |  |  |  |  |  |  |   45|  62.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.4k, False: 50.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  50.5k|    } else { \
  |  |  |  |  |  |  |  |   49|  50.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  50.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  50.5k|    } \
  |  |  |  |  |  |  |  |   52|  62.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  62.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  62.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  62.0k|{ \
  |  |  |  |  |  |  |  |  128|  67.2k|    do { \
  |  |  |  |  |  |  |  |  129|  67.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 7.67k, False: 59.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  7.67k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  7.67k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  7.67k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  7.67k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  7.67k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  7.67k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  7.67k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  7.67k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.13k, False: 542]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.13k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.02k, False: 106]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.02k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.02k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.02k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.02k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    106|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    106|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    106|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    106|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.13k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    542|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    542|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    542|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    542|        } \
  |  |  |  |  |  |  |  |  |  |  123|  7.67k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  7.67k|        } \
  |  |  |  |  |  |  |  |  132|  67.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  67.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  67.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  67.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.16k, False: 62.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  62.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  97.1k|        } else { \
  |  |  |  |  |  |  154|  97.1k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  97.1k|        } \
  |  |  |  |  |  |  156|   159k|    } \
  |  |  |  |  |  |  157|   217k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   217k|            v = v ^ spb; \
  |  |  |  |  455|   217k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 104k, False: 112k]
  |  |  |  |  ------------------
  |  |  |  |  456|   217k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   217k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   217k|{ \
  |  |  |  |  |  |  326|   217k|    /* east */ \
  |  |  |  |  |  |  327|   217k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   217k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   217k| \
  |  |  |  |  |  |  329|   217k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   217k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   217k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   217k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   217k| \
  |  |  |  |  |  |  332|   217k|    /* west */ \
  |  |  |  |  |  |  333|   217k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   217k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   217k| \
  |  |  |  |  |  |  335|   217k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   217k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   217k| \
  |  |  |  |  |  |  343|   217k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   217k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   217k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   217k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   217k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   217k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   217k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   217k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   217k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   217k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   217k|    } \
  |  |  |  |  |  |  350|   217k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   217k|        } \
  |  |  |  |  458|   414k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   414k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   414k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   414k|    } \
  |  |  |  |  460|  1.81M|}
  |  |  ------------------
  |  |  673|  1.81M|                                flags, flagsp, flags_stride, data, \
  |  |  674|  1.81M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  675|  1.81M|                            *flagsp = flags; \
  |  |  676|  1.81M|                        } \
  |  |  677|  2.11M|                } \
  |  |  678|  33.1k|        } \
  |  |  679|  2.06k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  2.06k|        mqc->curctx = curctx; \
  |  |  |  |  167|  2.06k|        mqc->c = c; \
  |  |  |  |  168|  2.06k|        mqc->a = a; \
  |  |  |  |  169|  2.06k|        mqc->ct = ct;
  |  |  ------------------
  |  |  680|  2.06k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (680:13): [True: 0, False: 2.06k]
  |  |  ------------------
  |  |  681|      0|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (681:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  682|      0|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (682:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  683|      0|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  684|      0|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  685|      0|                } \
  |  |  686|      0|            } \
  |  |  687|      0|        } \
  |  |  688|  2.06k|}
  ------------------
  702|  2.06k|}
t1.c:opj_t1_getctxno_zc:
  255|  25.8M|{
  256|  25.8M|    return mqc->lut_ctxno_zc_orient[(f & T1_SIGMA_NEIGHBOURS)];
  ------------------
  |  |  158|  25.8M|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  149|  25.8M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  25.8M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  150|  25.8M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  25.8M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  151|  25.8M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  25.8M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  152|  25.8M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  25.8M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  154|  25.8M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  25.8M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  155|  25.8M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|  25.8M|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  156|  25.8M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  25.8M|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  157|  25.8M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  25.8M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  257|  25.8M|}
t1.c:opj_t1_getctxtno_sc_or_spb_index:
  263|  10.3M|{
  264|       |    /*
  265|       |      0 pfX T1_CHI_THIS           T1_LUT_SGN_W
  266|       |      1 tfX T1_SIGMA_1            T1_LUT_SIG_N
  267|       |      2 nfX T1_CHI_THIS           T1_LUT_SGN_E
  268|       |      3 tfX T1_SIGMA_3            T1_LUT_SIG_W
  269|       |      4  fX T1_CHI_(THIS - 1)     T1_LUT_SGN_N
  270|       |      5 tfX T1_SIGMA_5            T1_LUT_SIG_E
  271|       |      6  fX T1_CHI_(THIS + 1)     T1_LUT_SGN_S
  272|       |      7 tfX T1_SIGMA_7            T1_LUT_SIG_S
  273|       |    */
  274|       |
  275|  10.3M|    OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   92|  10.3M|#define T1_SIGMA_1  (1U << 1)
  ------------------
                  OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   94|  10.3M|#define T1_SIGMA_3  (1U << 3)
  ------------------
                  OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   96|  10.3M|#define T1_SIGMA_5  (1U << 5)
  ------------------
  276|  10.3M|                                         T1_SIGMA_7);
  ------------------
  |  |   98|  10.3M|#define T1_SIGMA_7  (1U << 7)
  ------------------
  277|       |
  278|  10.3M|    lu |= (pfX >> (T1_CHI_THIS_I      + (ci * 3U))) & (1U << 0);
  ------------------
  |  |  161|  10.3M|#define T1_CHI_THIS_I T1_CHI_1_I
  |  |  ------------------
  |  |  |  |  113|  10.3M|#define T1_CHI_1_I  19
  |  |  ------------------
  ------------------
  279|  10.3M|    lu |= (nfX >> (T1_CHI_THIS_I - 2U + (ci * 3U))) & (1U << 2);
  ------------------
  |  |  161|  10.3M|#define T1_CHI_THIS_I T1_CHI_1_I
  |  |  ------------------
  |  |  |  |  113|  10.3M|#define T1_CHI_1_I  19
  |  |  ------------------
  ------------------
  280|  10.3M|    if (ci == 0U) {
  ------------------
  |  Branch (280:9): [True: 2.54M, False: 7.76M]
  ------------------
  281|  2.54M|        lu |= (fX >> (T1_CHI_0_I - 4U)) & (1U << 4);
  ------------------
  |  |  111|  2.54M|#define T1_CHI_0_I  18
  ------------------
  282|  7.76M|    } else {
  283|  7.76M|        lu |= (fX >> (T1_CHI_1_I - 4U + ((ci - 1U) * 3U))) & (1U << 4);
  ------------------
  |  |  113|  7.76M|#define T1_CHI_1_I  19
  ------------------
  284|  7.76M|    }
  285|  10.3M|    lu |= (fX >> (T1_CHI_2_I - 6U + (ci * 3U))) & (1U << 6);
  ------------------
  |  |  117|  10.3M|#define T1_CHI_2_I  22
  ------------------
  286|  10.3M|    return lu;
  287|  10.3M|}
t1.c:opj_t1_getctxno_sc:
  290|  10.3M|{
  291|  10.3M|    return lut_ctxno_sc[lu];
  292|  10.3M|}
t1.c:opj_t1_getspb:
  302|  10.3M|{
  303|  10.3M|    return lut_spb[lu];
  304|  10.3M|}
t1.c:opj_t1_dec_sigpass_step_mqc:
  470|   662k|{
  471|   662k|    OPJ_UINT32 v;
  472|       |
  473|   662k|    opj_mqc_t *mqc = &(t1->mqc);       /* MQC component */
  474|   662k|    opj_t1_dec_sigpass_step_mqc_macro(*flagsp, flagsp, flags_stride, datap,
  ------------------
  |  |  438|   662k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  439|   662k|{ \
  |  |  440|   662k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  ------------------
  |  |  |  |  153|   662k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|   662k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  ------------------
  |  |  |  |  163|   662k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|   662k|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (440:9): [True: 207k, False: 455k]
  |  |  ------------------
  |  |  441|   662k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  ------------------
  |  |  |  |  158|   207k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  149|   207k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   207k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|   207k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   207k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   207k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   207k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   207k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   207k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   207k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   207k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  155|   207k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   97|   207k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|   207k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   98|   207k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  157|   207k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   99|   207k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (441:9): [True: 126k, False: 81.0k]
  |  |  ------------------
  |  |  442|   126k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  443|   126k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  ------------------
  |  |  |  |   65|   126k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  444|   126k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   126k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   126k|{ \
  |  |  |  |  140|   126k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   126k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   126k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   126k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   126k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   126k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 22.9k, False: 103k]
  |  |  |  |  ------------------
  |  |  |  |  146|  22.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  22.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  22.9k|{ \
  |  |  |  |  |  |   57|  22.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 4.91k, False: 17.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  4.91k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  4.91k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  4.91k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  17.9k|    } else { \
  |  |  |  |  |  |   62|  17.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  17.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  17.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  17.9k|    } \
  |  |  |  |  |  |   66|  22.9k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  22.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  22.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  22.9k|{ \
  |  |  |  |  |  |  128|  36.9k|    do { \
  |  |  |  |  |  |  129|  36.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 4.62k, False: 32.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  4.62k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  4.62k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  4.62k|{ \
  |  |  |  |  |  |  |  |  104|  4.62k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  4.62k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  4.62k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  4.62k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  4.62k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.44k, False: 178]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  4.44k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.42k, False: 23]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  4.42k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  4.42k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  4.42k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  4.42k|            } else { \
  |  |  |  |  |  |  |  |  114|     23|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     23|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     23|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     23|            } \
  |  |  |  |  |  |  |  |  118|  4.44k|        } else { \
  |  |  |  |  |  |  |  |  119|    178|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    178|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    178|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    178|        } \
  |  |  |  |  |  |  |  |  123|  4.62k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  4.62k|        } \
  |  |  |  |  |  |  132|  36.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  36.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  36.9k|        ct--; \
  |  |  |  |  |  |  135|  36.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 14.0k, False: 22.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  22.9k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   103k|    } else {  \
  |  |  |  |  149|   103k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   103k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 23.9k, False: 79.2k]
  |  |  |  |  ------------------
  |  |  |  |  151|  23.9k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  23.9k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  23.9k|{ \
  |  |  |  |  |  |   45|  23.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 3.92k, False: 20.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  3.92k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  3.92k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  20.0k|    } else { \
  |  |  |  |  |  |   49|  20.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  20.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  20.0k|    } \
  |  |  |  |  |  |   52|  23.9k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  23.9k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  23.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  23.9k|{ \
  |  |  |  |  |  |  128|  25.7k|    do { \
  |  |  |  |  |  |  129|  25.7k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 3.18k, False: 22.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  3.18k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  3.18k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  3.18k|{ \
  |  |  |  |  |  |  |  |  104|  3.18k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  3.18k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  3.18k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  3.18k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  3.18k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.05k, False: 136]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  3.05k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.03k, False: 15]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  3.03k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  3.03k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  3.03k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  3.03k|            } else { \
  |  |  |  |  |  |  |  |  114|     15|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     15|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     15|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     15|            } \
  |  |  |  |  |  |  |  |  118|  3.05k|        } else { \
  |  |  |  |  |  |  |  |  119|    136|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    136|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    136|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    136|        } \
  |  |  |  |  |  |  |  |  123|  3.18k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  3.18k|        } \
  |  |  |  |  |  |  132|  25.7k|        a <<= 1; \
  |  |  |  |  |  |  133|  25.7k|        c <<= 1; \
  |  |  |  |  |  |  134|  25.7k|        ct--; \
  |  |  |  |  |  |  135|  25.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 1.78k, False: 23.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  23.9k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  79.2k|        } else { \
  |  |  |  |  154|  79.2k|            d = (*curctx)->mps; \
  |  |  |  |  155|  79.2k|        } \
  |  |  |  |  156|   103k|    } \
  |  |  |  |  157|   126k|}
  |  |  ------------------
  |  |  445|   126k|        if (v) { \
  |  |  ------------------
  |  |  |  Branch (445:13): [True: 44.6k, False: 81.4k]
  |  |  ------------------
  |  |  446|  44.6k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  447|  44.6k|                                flags, \
  |  |  448|  44.6k|                                flagsp[-1], flagsp[1], \
  |  |  449|  44.6k|                                ci); \
  |  |  450|  44.6k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  451|  44.6k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  452|  44.6k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  ------------------
  |  |  |  |   65|  44.6k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  453|  44.6k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  44.6k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  44.6k|{ \
  |  |  |  |  140|  44.6k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  44.6k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  44.6k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  44.6k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  44.6k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  44.6k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 11.1k, False: 33.4k]
  |  |  |  |  ------------------
  |  |  |  |  146|  11.1k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  11.1k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  11.1k|{ \
  |  |  |  |  |  |   57|  11.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 2.34k, False: 8.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  2.34k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  2.34k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  2.34k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  8.81k|    } else { \
  |  |  |  |  |  |   62|  8.81k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  8.81k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  8.81k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  8.81k|    } \
  |  |  |  |  |  |   66|  11.1k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  11.1k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  11.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  11.1k|{ \
  |  |  |  |  |  |  128|  17.9k|    do { \
  |  |  |  |  |  |  129|  17.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 2.28k, False: 15.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  2.28k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  2.28k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  2.28k|{ \
  |  |  |  |  |  |  |  |  104|  2.28k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  2.28k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  2.28k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  2.28k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  2.28k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.17k, False: 105]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  2.17k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.16k, False: 8]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  2.16k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  2.16k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  2.16k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  2.16k|            } else { \
  |  |  |  |  |  |  |  |  114|      8|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      8|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      8|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      8|            } \
  |  |  |  |  |  |  |  |  118|  2.17k|        } else { \
  |  |  |  |  |  |  |  |  119|    105|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    105|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    105|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    105|        } \
  |  |  |  |  |  |  |  |  123|  2.28k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  2.28k|        } \
  |  |  |  |  |  |  132|  17.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  17.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  17.9k|        ct--; \
  |  |  |  |  |  |  135|  17.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 6.74k, False: 11.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  11.1k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  33.4k|    } else {  \
  |  |  |  |  149|  33.4k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  33.4k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 12.2k, False: 21.2k]
  |  |  |  |  ------------------
  |  |  |  |  151|  12.2k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  12.2k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  12.2k|{ \
  |  |  |  |  |  |   45|  12.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 2.16k, False: 10.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  2.16k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  2.16k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  10.1k|    } else { \
  |  |  |  |  |  |   49|  10.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  10.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  10.1k|    } \
  |  |  |  |  |  |   52|  12.2k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  12.2k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  12.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  12.2k|{ \
  |  |  |  |  |  |  128|  13.2k|    do { \
  |  |  |  |  |  |  129|  13.2k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.64k, False: 11.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.64k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.64k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.64k|{ \
  |  |  |  |  |  |  |  |  104|  1.64k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.64k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.64k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.64k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.64k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.55k, False: 90]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  1.55k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.54k, False: 10]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.54k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.54k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.54k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.54k|            } else { \
  |  |  |  |  |  |  |  |  114|     10|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     10|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     10|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     10|            } \
  |  |  |  |  |  |  |  |  118|  1.55k|        } else { \
  |  |  |  |  |  |  |  |  119|     90|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     90|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     90|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     90|        } \
  |  |  |  |  |  |  |  |  123|  1.64k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.64k|        } \
  |  |  |  |  |  |  132|  13.2k|        a <<= 1; \
  |  |  |  |  |  |  133|  13.2k|        c <<= 1; \
  |  |  |  |  |  |  134|  13.2k|        ct--; \
  |  |  |  |  |  |  135|  13.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 965, False: 12.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  12.2k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  21.2k|        } else { \
  |  |  |  |  154|  21.2k|            d = (*curctx)->mps; \
  |  |  |  |  155|  21.2k|        } \
  |  |  |  |  156|  33.4k|    } \
  |  |  |  |  157|  44.6k|}
  |  |  ------------------
  |  |  454|  44.6k|            v = v ^ spb; \
  |  |  455|  44.6k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  ------------------
  |  |  |  Branch (455:36): [True: 22.5k, False: 22.1k]
  |  |  ------------------
  |  |  456|  44.6k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  ------------------
  |  |  |  |  324|  44.6k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  325|  44.6k|{ \
  |  |  |  |  326|  44.6k|    /* east */ \
  |  |  |  |  327|  44.6k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  44.6k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  |  |  328|  44.6k| \
  |  |  |  |  329|  44.6k|    /* mark target as significant */ \
  |  |  |  |  330|  44.6k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  44.6k|#define T1_CHI_1_I  19
  |  |  |  |  ------------------
  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  44.6k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  |  |  331|  44.6k| \
  |  |  |  |  332|  44.6k|    /* west */ \
  |  |  |  |  333|  44.6k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  44.6k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  |  |  334|  44.6k| \
  |  |  |  |  335|  44.6k|    /* north-west, north, north-east */ \
  |  |  |  |  336|  44.6k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (336:9): [True: 20.0k, False: 24.6k]
  |  |  |  |  |  Branch (336:21): [True: 8.51k, False: 11.5k]
  |  |  |  |  ------------------
  |  |  |  |  337|  8.51k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  338|  8.51k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|  8.51k|#define T1_CHI_5_I  31
  |  |  |  |  ------------------
  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  8.51k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  ------------------
  |  |  |  |  339|  8.51k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  8.51k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  ------------------
  |  |  |  |  340|  8.51k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|  8.51k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  ------------------
  |  |  |  |  341|  8.51k|    } \
  |  |  |  |  342|  44.6k| \
  |  |  |  |  343|  44.6k|    /* south-west, south, south-east */ \
  |  |  |  |  344|  44.6k|    if (ci == 3U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:9): [True: 0, False: 44.6k]
  |  |  |  |  ------------------
  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  ------------------
  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  ------------------
  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  |  |  349|      0|    } \
  |  |  |  |  350|  44.6k|}
  |  |  ------------------
  |  |  457|  44.6k|        } \
  |  |  458|   126k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  ------------------
  |  |  |  |  163|   126k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|   126k|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|   126k|    } \
  |  |  460|   662k|}
  ------------------
  475|   662k|                                      0, ci, mqc, mqc->curctx,
  476|   662k|                                      v, mqc->a, mqc->c, mqc->ct, oneplushalf, vsc);
  477|   662k|}
t1.c:opj_t1_dec_sigpass_mqc_64x64_novsc:
  693|  5.55k|{
  694|  5.55k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_FALSE, 64, 64, 66);
  ------------------
  |  |  646|  5.55k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  647|  5.55k|{ \
  |  |  648|  5.55k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  649|  5.55k|        OPJ_UINT32 i, j, k; \
  |  |  650|  5.55k|        register OPJ_INT32 *data = t1->data; \
  |  |  651|  5.55k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  652|  5.55k|        const OPJ_UINT32 l_w = w; \
  |  |  653|  5.55k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  654|  5.55k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  5.55k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  5.55k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  5.55k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  5.55k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  655|  5.55k|        register OPJ_UINT32 v; \
  |  |  656|  5.55k|        one = 1 << bpno; \
  |  |  657|  5.55k|        half = one >> 1; \
  |  |  658|  5.55k|        oneplushalf = one | half; \
  |  |  659|  94.4k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (659:21): [True: 88.9k, False: 5.55k]
  |  |  ------------------
  |  |  660|  5.77M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (660:29): [True: 5.69M, False: 88.9k]
  |  |  ------------------
  |  |  661|  5.69M|                        opj_flag_t flags = *flagsp; \
  |  |  662|  5.69M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (662:29): [True: 2.46M, False: 3.22M]
  |  |  ------------------
  |  |  663|  2.46M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  2.46M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  2.46M|{ \
  |  |  |  |  440|  2.46M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.46M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.46M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.46M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.46M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 1.41M, False: 1.05M]
  |  |  |  |  ------------------
  |  |  |  |  441|  2.46M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.41M|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|  1.41M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  1.41M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  1.41M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  1.41M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|  1.41M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  1.41M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|  1.41M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  1.41M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  1.41M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  1.41M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|  1.41M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  1.41M|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|  1.41M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  1.41M|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|  1.41M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  1.41M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 1.11M, False: 297k]
  |  |  |  |  ------------------
  |  |  |  |  442|  1.11M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  1.11M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.11M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  1.11M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.11M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.11M|{ \
  |  |  |  |  |  |  140|  1.11M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.11M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.11M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.11M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.11M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.11M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 337k, False: 780k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   337k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   337k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   337k|{ \
  |  |  |  |  |  |  |  |   57|   337k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 68.0k, False: 269k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  68.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  68.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  68.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   269k|    } else { \
  |  |  |  |  |  |  |  |   62|   269k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   269k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   269k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   269k|    } \
  |  |  |  |  |  |  |  |   66|   337k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   337k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   337k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   337k|{ \
  |  |  |  |  |  |  |  |  128|   528k|    do { \
  |  |  |  |  |  |  |  |  129|   528k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 66.0k, False: 462k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  66.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  66.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  66.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  66.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  66.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  66.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  66.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  66.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.10k, False: 58.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.10k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.88k, False: 224]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.88k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.88k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.88k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.88k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    224|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    224|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    224|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    224|            } \
  |  |  |  |  |  |  |  |  |  |  118|  58.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  58.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  58.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  58.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  58.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  66.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  66.0k|        } \
  |  |  |  |  |  |  |  |  132|   528k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   528k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   528k|        ct--; \
  |  |  |  |  |  |  |  |  135|   528k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 190k, False: 337k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   337k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   780k|    } else {  \
  |  |  |  |  |  |  149|   780k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   780k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 310k, False: 469k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   310k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   310k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   310k|{ \
  |  |  |  |  |  |  |  |   45|   310k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 55.5k, False: 254k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  55.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  55.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   254k|    } else { \
  |  |  |  |  |  |  |  |   49|   254k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   254k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   254k|    } \
  |  |  |  |  |  |  |  |   52|   310k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   310k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   310k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   310k|{ \
  |  |  |  |  |  |  |  |  128|   337k|    do { \
  |  |  |  |  |  |  |  |  129|   337k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 42.5k, False: 295k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  42.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  42.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  42.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  42.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  42.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  42.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  42.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  42.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.97k, False: 37.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.97k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.78k, False: 197]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.78k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.78k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.78k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.78k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    197|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    197|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    197|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    197|            } \
  |  |  |  |  |  |  |  |  |  |  118|  37.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  37.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  37.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  37.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  37.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  42.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  42.5k|        } \
  |  |  |  |  |  |  |  |  132|   337k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   337k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   337k|        ct--; \
  |  |  |  |  |  |  |  |  135|   337k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 27.4k, False: 310k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   310k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   469k|        } else { \
  |  |  |  |  |  |  154|   469k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   469k|        } \
  |  |  |  |  |  |  156|   780k|    } \
  |  |  |  |  |  |  157|  1.11M|}
  |  |  |  |  ------------------
  |  |  |  |  445|  1.11M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 419k, False: 698k]
  |  |  |  |  ------------------
  |  |  |  |  446|   419k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   419k|                                flags, \
  |  |  |  |  448|   419k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   419k|                                ci); \
  |  |  |  |  450|   419k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   419k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   419k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   419k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   419k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   419k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   419k|{ \
  |  |  |  |  |  |  140|   419k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   419k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   419k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   419k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   419k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   419k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 129k, False: 289k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   129k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   129k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   129k|{ \
  |  |  |  |  |  |  |  |   57|   129k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 23.3k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  23.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  23.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  23.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   106k|    } else { \
  |  |  |  |  |  |  |  |   62|   106k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   106k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   106k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   106k|    } \
  |  |  |  |  |  |  |  |   66|   129k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   129k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   129k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   129k|{ \
  |  |  |  |  |  |  |  |  128|   210k|    do { \
  |  |  |  |  |  |  |  |  129|   210k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 26.3k, False: 184k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  26.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  26.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  26.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  26.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  26.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  26.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  26.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  26.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.72k, False: 22.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.72k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.57k, False: 149]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.57k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.57k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.57k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.57k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    149|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    149|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    149|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    149|            } \
  |  |  |  |  |  |  |  |  |  |  118|  22.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  22.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  22.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  22.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  22.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  26.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  26.3k|        } \
  |  |  |  |  |  |  |  |  132|   210k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   210k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   210k|        ct--; \
  |  |  |  |  |  |  |  |  135|   210k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 81.2k, False: 129k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   129k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   289k|    } else {  \
  |  |  |  |  |  |  149|   289k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   289k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 126k, False: 163k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   126k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   126k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   126k|{ \
  |  |  |  |  |  |  |  |   45|   126k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 19.8k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  19.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  19.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   106k|    } else { \
  |  |  |  |  |  |  |  |   49|   106k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   106k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   106k|    } \
  |  |  |  |  |  |  |  |   52|   126k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   126k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   126k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   126k|{ \
  |  |  |  |  |  |  |  |  128|   136k|    do { \
  |  |  |  |  |  |  |  |  129|   136k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.8k, False: 119k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.56k, False: 14.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.56k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.48k, False: 73]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.48k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.48k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.48k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.48k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     73|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     73|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     73|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     73|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.8k|        } \
  |  |  |  |  |  |  |  |  132|   136k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   136k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   136k|        ct--; \
  |  |  |  |  |  |  |  |  135|   136k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9.43k, False: 126k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   126k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   163k|        } else { \
  |  |  |  |  |  |  154|   163k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   163k|        } \
  |  |  |  |  |  |  156|   289k|    } \
  |  |  |  |  |  |  157|   419k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   419k|            v = v ^ spb; \
  |  |  |  |  455|   419k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 187k, False: 231k]
  |  |  |  |  ------------------
  |  |  |  |  456|   419k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   419k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   419k|{ \
  |  |  |  |  |  |  326|   419k|    /* east */ \
  |  |  |  |  |  |  327|   419k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   419k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   419k| \
  |  |  |  |  |  |  329|   419k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   419k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   419k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   419k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   419k| \
  |  |  |  |  |  |  332|   419k|    /* west */ \
  |  |  |  |  |  |  333|   419k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   419k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   419k| \
  |  |  |  |  |  |  335|   419k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   419k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|   419k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|   419k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|   419k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|   419k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|   419k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|   419k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|   419k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|   419k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|   419k|    } \
  |  |  |  |  |  |  342|   419k| \
  |  |  |  |  |  |  343|   419k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   419k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   419k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   419k|        } \
  |  |  |  |  458|  1.11M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.11M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.11M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  1.11M|    } \
  |  |  |  |  460|  2.46M|}
  |  |  ------------------
  |  |  664|  2.46M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  2.46M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  666|  2.46M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  2.46M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  2.46M|{ \
  |  |  |  |  440|  2.46M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.46M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.46M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.46M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.46M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 1.43M, False: 1.02M]
  |  |  |  |  ------------------
  |  |  |  |  441|  2.46M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.43M|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|  1.43M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  1.43M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  1.43M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  1.43M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|  1.43M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  1.43M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|  1.43M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  1.43M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  1.43M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  1.43M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|  1.43M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  1.43M|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|  1.43M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  1.43M|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|  1.43M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  1.43M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 1.13M, False: 307k]
  |  |  |  |  ------------------
  |  |  |  |  442|  1.13M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  1.13M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.13M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  1.13M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.13M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.13M|{ \
  |  |  |  |  |  |  140|  1.13M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.13M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.13M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.13M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.13M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.13M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 342k, False: 789k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   342k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   342k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   342k|{ \
  |  |  |  |  |  |  |  |   57|   342k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 70.9k, False: 271k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  70.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  70.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  70.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   271k|    } else { \
  |  |  |  |  |  |  |  |   62|   271k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   271k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   271k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   271k|    } \
  |  |  |  |  |  |  |  |   66|   342k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   342k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   342k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   342k|{ \
  |  |  |  |  |  |  |  |  128|   529k|    do { \
  |  |  |  |  |  |  |  |  129|   529k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 66.2k, False: 463k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  66.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  66.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  66.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  66.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  66.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  66.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  66.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  66.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.28k, False: 58.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.28k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.97k, False: 307]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.97k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.97k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.97k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.97k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    307|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    307|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    307|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    307|            } \
  |  |  |  |  |  |  |  |  |  |  118|  58.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  58.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  58.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  58.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  58.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  66.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  66.2k|        } \
  |  |  |  |  |  |  |  |  132|   529k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   529k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   529k|        ct--; \
  |  |  |  |  |  |  |  |  135|   529k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 187k, False: 342k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   342k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   789k|    } else {  \
  |  |  |  |  |  |  149|   789k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   789k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 320k, False: 468k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   320k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   320k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   320k|{ \
  |  |  |  |  |  |  |  |   45|   320k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 58.5k, False: 261k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  58.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  58.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   261k|    } else { \
  |  |  |  |  |  |  |  |   49|   261k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   261k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   261k|    } \
  |  |  |  |  |  |  |  |   52|   320k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   320k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   320k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   320k|{ \
  |  |  |  |  |  |  |  |  128|   348k|    do { \
  |  |  |  |  |  |  |  |  129|   348k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 43.4k, False: 305k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  43.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  43.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  43.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  43.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  43.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  43.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  43.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  43.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.04k, False: 38.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.04k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.83k, False: 210]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.83k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.83k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.83k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.83k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    210|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    210|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    210|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    210|            } \
  |  |  |  |  |  |  |  |  |  |  118|  38.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  38.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  38.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  38.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  38.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  43.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  43.4k|        } \
  |  |  |  |  |  |  |  |  132|   348k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   348k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   348k|        ct--; \
  |  |  |  |  |  |  |  |  135|   348k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 28.8k, False: 320k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   320k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   468k|        } else { \
  |  |  |  |  |  |  154|   468k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   468k|        } \
  |  |  |  |  |  |  156|   789k|    } \
  |  |  |  |  |  |  157|  1.13M|}
  |  |  |  |  ------------------
  |  |  |  |  445|  1.13M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 420k, False: 710k]
  |  |  |  |  ------------------
  |  |  |  |  446|   420k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   420k|                                flags, \
  |  |  |  |  448|   420k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   420k|                                ci); \
  |  |  |  |  450|   420k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   420k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   420k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   420k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   420k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   420k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   420k|{ \
  |  |  |  |  |  |  140|   420k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   420k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   420k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   420k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   420k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   420k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 122k, False: 297k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   122k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   122k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   122k|{ \
  |  |  |  |  |  |  |  |   57|   122k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 23.0k, False: 99.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  23.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  23.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  23.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  99.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  99.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  99.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  99.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  99.9k|    } \
  |  |  |  |  |  |  |  |   66|   122k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   122k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   122k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   122k|{ \
  |  |  |  |  |  |  |  |  128|   197k|    do { \
  |  |  |  |  |  |  |  |  129|   197k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24.5k, False: 172k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  24.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  24.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  24.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  24.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  24.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  24.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  24.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  24.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.69k, False: 20.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.69k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.56k, False: 135]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.56k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.56k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.56k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.56k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    135|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    135|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    135|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    135|            } \
  |  |  |  |  |  |  |  |  |  |  118|  20.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  20.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  20.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  20.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  20.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  24.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  24.5k|        } \
  |  |  |  |  |  |  |  |  132|   197k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   197k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   197k|        ct--; \
  |  |  |  |  |  |  |  |  135|   197k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 74.2k, False: 122k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   122k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   297k|    } else {  \
  |  |  |  |  |  |  149|   297k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   297k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 128k, False: 169k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   128k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   128k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   128k|{ \
  |  |  |  |  |  |  |  |   45|   128k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 19.0k, False: 109k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  19.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  19.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   109k|    } else { \
  |  |  |  |  |  |  |  |   49|   109k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   109k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   109k|    } \
  |  |  |  |  |  |  |  |   52|   128k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   128k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   128k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   128k|{ \
  |  |  |  |  |  |  |  |  128|   137k|    do { \
  |  |  |  |  |  |  |  |  129|   137k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.3k, False: 119k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  17.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  17.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  17.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  17.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  17.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  17.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  17.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  17.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.58k, False: 14.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.58k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.48k, False: 102]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.48k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.48k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.48k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.48k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    102|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    102|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    102|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    102|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.3k|        } \
  |  |  |  |  |  |  |  |  132|   137k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   137k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   137k|        ct--; \
  |  |  |  |  |  |  |  |  135|   137k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8.85k, False: 128k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   128k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   169k|        } else { \
  |  |  |  |  |  |  154|   169k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   169k|        } \
  |  |  |  |  |  |  156|   297k|    } \
  |  |  |  |  |  |  157|   420k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   420k|            v = v ^ spb; \
  |  |  |  |  455|   420k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 185k, False: 235k]
  |  |  |  |  ------------------
  |  |  |  |  456|   420k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   420k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   420k|{ \
  |  |  |  |  |  |  326|   420k|    /* east */ \
  |  |  |  |  |  |  327|   420k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   420k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   420k| \
  |  |  |  |  |  |  329|   420k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   420k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   420k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   420k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   420k| \
  |  |  |  |  |  |  332|   420k|    /* west */ \
  |  |  |  |  |  |  333|   420k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   420k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   420k| \
  |  |  |  |  |  |  335|   420k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   420k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   420k| \
  |  |  |  |  |  |  343|   420k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   420k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   420k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   420k|        } \
  |  |  |  |  458|  1.13M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.13M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.13M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  1.13M|    } \
  |  |  |  |  460|  2.46M|}
  |  |  ------------------
  |  |  667|  2.46M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  2.46M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  2.46M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  2.46M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  2.46M|{ \
  |  |  |  |  440|  2.46M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.46M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.46M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.46M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.46M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 1.43M, False: 1.03M]
  |  |  |  |  ------------------
  |  |  |  |  441|  2.46M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.43M|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|  1.43M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  1.43M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  1.43M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  1.43M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|  1.43M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  1.43M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|  1.43M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  1.43M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  1.43M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  1.43M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|  1.43M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  1.43M|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|  1.43M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  1.43M|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|  1.43M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  1.43M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 1.14M, False: 292k]
  |  |  |  |  ------------------
  |  |  |  |  442|  1.14M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  1.14M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.14M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  1.14M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.14M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.14M|{ \
  |  |  |  |  |  |  140|  1.14M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.14M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.14M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.14M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.14M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.14M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 336k, False: 805k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   336k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   336k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   336k|{ \
  |  |  |  |  |  |  |  |   57|   336k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 69.0k, False: 267k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  69.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  69.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  69.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   267k|    } else { \
  |  |  |  |  |  |  |  |   62|   267k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   267k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   267k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   267k|    } \
  |  |  |  |  |  |  |  |   66|   336k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   336k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   336k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   336k|{ \
  |  |  |  |  |  |  |  |  128|   525k|    do { \
  |  |  |  |  |  |  |  |  129|   525k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 66.1k, False: 459k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  66.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  66.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  66.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  66.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  66.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  66.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  66.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  66.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.23k, False: 58.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.23k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.91k, False: 317]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.91k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.91k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.91k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.91k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    317|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    317|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    317|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    317|            } \
  |  |  |  |  |  |  |  |  |  |  118|  58.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  58.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  58.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  58.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  58.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  66.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  66.1k|        } \
  |  |  |  |  |  |  |  |  132|   525k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   525k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   525k|        ct--; \
  |  |  |  |  |  |  |  |  135|   525k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 189k, False: 336k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   336k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   805k|    } else {  \
  |  |  |  |  |  |  149|   805k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   805k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 318k, False: 487k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   318k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   318k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   318k|{ \
  |  |  |  |  |  |  |  |   45|   318k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 56.2k, False: 262k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  56.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  56.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   262k|    } else { \
  |  |  |  |  |  |  |  |   49|   262k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   262k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   262k|    } \
  |  |  |  |  |  |  |  |   52|   318k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   318k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   318k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   318k|{ \
  |  |  |  |  |  |  |  |  128|   345k|    do { \
  |  |  |  |  |  |  |  |  129|   345k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 43.2k, False: 302k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  43.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  43.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  43.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  43.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  43.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  43.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  43.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  43.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.93k, False: 38.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.93k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.72k, False: 216]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.72k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.72k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.72k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.72k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    216|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    216|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    216|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    216|            } \
  |  |  |  |  |  |  |  |  |  |  118|  38.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  38.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  38.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  38.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  38.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  43.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  43.2k|        } \
  |  |  |  |  |  |  |  |  132|   345k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   345k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   345k|        ct--; \
  |  |  |  |  |  |  |  |  135|   345k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 27.2k, False: 318k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   318k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   487k|        } else { \
  |  |  |  |  |  |  154|   487k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   487k|        } \
  |  |  |  |  |  |  156|   805k|    } \
  |  |  |  |  |  |  157|  1.14M|}
  |  |  |  |  ------------------
  |  |  |  |  445|  1.14M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 420k, False: 722k]
  |  |  |  |  ------------------
  |  |  |  |  446|   420k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   420k|                                flags, \
  |  |  |  |  448|   420k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   420k|                                ci); \
  |  |  |  |  450|   420k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   420k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   420k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   420k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   420k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   420k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   420k|{ \
  |  |  |  |  |  |  140|   420k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   420k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   420k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   420k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   420k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   420k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 125k, False: 295k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   125k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   125k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   125k|{ \
  |  |  |  |  |  |  |  |   57|   125k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 23.1k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  23.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  23.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  23.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   102k|    } else { \
  |  |  |  |  |  |  |  |   62|   102k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   102k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   102k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   102k|    } \
  |  |  |  |  |  |  |  |   66|   125k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   125k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   125k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   125k|{ \
  |  |  |  |  |  |  |  |  128|   202k|    do { \
  |  |  |  |  |  |  |  |  129|   202k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24.9k, False: 177k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  24.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  24.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  24.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  24.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  24.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  24.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  24.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  24.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.81k, False: 21.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.81k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.68k, False: 132]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.68k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.68k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.68k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.68k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    132|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    132|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    132|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    132|            } \
  |  |  |  |  |  |  |  |  |  |  118|  21.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  21.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  21.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  21.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  21.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  24.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  24.9k|        } \
  |  |  |  |  |  |  |  |  132|   202k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   202k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   202k|        ct--; \
  |  |  |  |  |  |  |  |  135|   202k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 76.6k, False: 125k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   125k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   295k|    } else {  \
  |  |  |  |  |  |  149|   295k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   295k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 127k, False: 167k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   127k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   127k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   127k|{ \
  |  |  |  |  |  |  |  |   45|   127k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 19.2k, False: 108k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  19.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  19.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   108k|    } else { \
  |  |  |  |  |  |  |  |   49|   108k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   108k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   108k|    } \
  |  |  |  |  |  |  |  |   52|   127k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   127k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   127k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   127k|{ \
  |  |  |  |  |  |  |  |  128|   136k|    do { \
  |  |  |  |  |  |  |  |  129|   136k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.0k, False: 119k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  17.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  17.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  17.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  17.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  17.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  17.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  17.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  17.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.54k, False: 14.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.54k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.46k, False: 80]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.46k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.46k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.46k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.46k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     80|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     80|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     80|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     80|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.0k|        } \
  |  |  |  |  |  |  |  |  132|   136k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   136k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   136k|        ct--; \
  |  |  |  |  |  |  |  |  135|   136k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8.88k, False: 127k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   127k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   167k|        } else { \
  |  |  |  |  |  |  154|   167k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   167k|        } \
  |  |  |  |  |  |  156|   295k|    } \
  |  |  |  |  |  |  157|   420k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   420k|            v = v ^ spb; \
  |  |  |  |  455|   420k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 186k, False: 233k]
  |  |  |  |  ------------------
  |  |  |  |  456|   420k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   420k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   420k|{ \
  |  |  |  |  |  |  326|   420k|    /* east */ \
  |  |  |  |  |  |  327|   420k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   420k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   420k| \
  |  |  |  |  |  |  329|   420k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   420k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   420k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   420k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   420k| \
  |  |  |  |  |  |  332|   420k|    /* west */ \
  |  |  |  |  |  |  333|   420k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   420k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   420k| \
  |  |  |  |  |  |  335|   420k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   420k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   420k| \
  |  |  |  |  |  |  343|   420k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   420k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   420k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   420k|        } \
  |  |  |  |  458|  1.14M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.14M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.14M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  1.14M|    } \
  |  |  |  |  460|  2.46M|}
  |  |  ------------------
  |  |  670|  2.46M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  2.46M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  2.46M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  2.46M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  2.46M|{ \
  |  |  |  |  440|  2.46M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.46M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.46M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.46M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.46M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 1.39M, False: 1.07M]
  |  |  |  |  ------------------
  |  |  |  |  441|  2.46M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.39M|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|  1.39M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  1.39M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  1.39M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  1.39M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|  1.39M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  1.39M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|  1.39M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  1.39M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  1.39M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  1.39M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|  1.39M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  1.39M|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|  1.39M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  1.39M|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|  1.39M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  1.39M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 1.05M, False: 340k]
  |  |  |  |  ------------------
  |  |  |  |  442|  1.05M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  1.05M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.05M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  1.05M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.05M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.05M|{ \
  |  |  |  |  |  |  140|  1.05M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.05M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.05M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.05M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.05M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.05M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 329k, False: 727k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   329k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   329k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   329k|{ \
  |  |  |  |  |  |  |  |   57|   329k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 67.3k, False: 262k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  67.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  67.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  67.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   262k|    } else { \
  |  |  |  |  |  |  |  |   62|   262k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   262k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   262k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   262k|    } \
  |  |  |  |  |  |  |  |   66|   329k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   329k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   329k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   329k|{ \
  |  |  |  |  |  |  |  |  128|   509k|    do { \
  |  |  |  |  |  |  |  |  129|   509k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 63.6k, False: 445k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  63.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  63.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  63.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  63.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  63.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  63.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  63.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  63.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.23k, False: 56.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.23k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.02k, False: 217]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.02k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.02k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.02k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.02k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    217|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    217|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    217|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    217|            } \
  |  |  |  |  |  |  |  |  |  |  118|  56.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  56.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  56.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  56.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  56.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  63.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  63.6k|        } \
  |  |  |  |  |  |  |  |  132|   509k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   509k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   509k|        ct--; \
  |  |  |  |  |  |  |  |  135|   509k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 180k, False: 329k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   329k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   727k|    } else {  \
  |  |  |  |  |  |  149|   727k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   727k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 294k, False: 433k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   294k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   294k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   294k|{ \
  |  |  |  |  |  |  |  |   45|   294k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 55.9k, False: 238k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  55.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  55.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   238k|    } else { \
  |  |  |  |  |  |  |  |   49|   238k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   238k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   238k|    } \
  |  |  |  |  |  |  |  |   52|   294k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   294k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   294k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   294k|{ \
  |  |  |  |  |  |  |  |  128|   322k|    do { \
  |  |  |  |  |  |  |  |  129|   322k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 40.7k, False: 282k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  40.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  40.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  40.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  40.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  40.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  40.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  40.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  40.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.92k, False: 35.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.92k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.71k, False: 210]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.71k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.71k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.71k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.71k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    210|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    210|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    210|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    210|            } \
  |  |  |  |  |  |  |  |  |  |  118|  35.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  35.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  35.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  35.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  35.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  40.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  40.7k|        } \
  |  |  |  |  |  |  |  |  132|   322k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   322k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   322k|        ct--; \
  |  |  |  |  |  |  |  |  135|   322k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 28.0k, False: 294k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   294k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   433k|        } else { \
  |  |  |  |  |  |  154|   433k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   433k|        } \
  |  |  |  |  |  |  156|   727k|    } \
  |  |  |  |  |  |  157|  1.05M|}
  |  |  |  |  ------------------
  |  |  |  |  445|  1.05M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 406k, False: 650k]
  |  |  |  |  ------------------
  |  |  |  |  446|   406k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   406k|                                flags, \
  |  |  |  |  448|   406k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   406k|                                ci); \
  |  |  |  |  450|   406k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   406k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   406k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   406k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   406k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   406k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   406k|{ \
  |  |  |  |  |  |  140|   406k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   406k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   406k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   406k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   406k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   406k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 121k, False: 284k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   121k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   121k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   121k|{ \
  |  |  |  |  |  |  |  |   57|   121k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 22.4k, False: 99.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  22.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  22.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  22.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  99.5k|    } else { \
  |  |  |  |  |  |  |  |   62|  99.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  99.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  99.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  99.5k|    } \
  |  |  |  |  |  |  |  |   66|   121k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   121k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   121k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   121k|{ \
  |  |  |  |  |  |  |  |  128|   196k|    do { \
  |  |  |  |  |  |  |  |  129|   196k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24.4k, False: 171k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  24.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  24.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  24.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  24.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  24.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  24.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  24.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  24.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.62k, False: 20.7k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.62k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.50k, False: 121]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.50k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.50k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.50k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.50k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    121|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    121|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    121|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    121|            } \
  |  |  |  |  |  |  |  |  |  |  118|  20.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  20.7k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  20.7k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  20.7k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  20.7k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  24.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  24.4k|        } \
  |  |  |  |  |  |  |  |  132|   196k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   196k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   196k|        ct--; \
  |  |  |  |  |  |  |  |  135|   196k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 74.3k, False: 121k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   121k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   284k|    } else {  \
  |  |  |  |  |  |  149|   284k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   284k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 123k, False: 160k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   123k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   123k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   123k|{ \
  |  |  |  |  |  |  |  |   45|   123k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 18.8k, False: 105k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  18.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  18.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   105k|    } else { \
  |  |  |  |  |  |  |  |   49|   105k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   105k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   105k|    } \
  |  |  |  |  |  |  |  |   52|   123k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   123k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   123k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   123k|{ \
  |  |  |  |  |  |  |  |  128|   132k|    do { \
  |  |  |  |  |  |  |  |  129|   132k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.5k, False: 116k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.65k, False: 13.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.65k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.53k, False: 114]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.53k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.53k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.53k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.53k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    114|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    114|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    114|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    114|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  13.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  13.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  13.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  13.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.5k|        } \
  |  |  |  |  |  |  |  |  132|   132k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   132k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   132k|        ct--; \
  |  |  |  |  |  |  |  |  135|   132k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8.96k, False: 123k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   123k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   160k|        } else { \
  |  |  |  |  |  |  154|   160k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   160k|        } \
  |  |  |  |  |  |  156|   284k|    } \
  |  |  |  |  |  |  157|   406k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   406k|            v = v ^ spb; \
  |  |  |  |  455|   406k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 182k, False: 223k]
  |  |  |  |  ------------------
  |  |  |  |  456|   406k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   406k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   406k|{ \
  |  |  |  |  |  |  326|   406k|    /* east */ \
  |  |  |  |  |  |  327|   406k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   406k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   406k| \
  |  |  |  |  |  |  329|   406k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   406k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   406k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   406k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   406k| \
  |  |  |  |  |  |  332|   406k|    /* west */ \
  |  |  |  |  |  |  333|   406k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   406k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   406k| \
  |  |  |  |  |  |  335|   406k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   406k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   406k| \
  |  |  |  |  |  |  343|   406k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   406k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   406k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   406k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   406k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   406k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   406k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   406k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   406k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   406k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   406k|    } \
  |  |  |  |  |  |  350|   406k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   406k|        } \
  |  |  |  |  458|  1.05M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.05M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.05M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  1.05M|    } \
  |  |  |  |  460|  2.46M|}
  |  |  ------------------
  |  |  673|  2.46M|                                flags, flagsp, flags_stride, data, \
  |  |  674|  2.46M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  675|  2.46M|                            *flagsp = flags; \
  |  |  676|  2.46M|                        } \
  |  |  677|  5.69M|                } \
  |  |  678|  88.9k|        } \
  |  |  679|  5.55k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  5.55k|        mqc->curctx = curctx; \
  |  |  |  |  167|  5.55k|        mqc->c = c; \
  |  |  |  |  168|  5.55k|        mqc->a = a; \
  |  |  |  |  169|  5.55k|        mqc->ct = ct;
  |  |  ------------------
  |  |  680|  5.55k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (680:13): [True: 0, False: 5.55k]
  |  |  ------------------
  |  |  681|      0|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (681:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  682|      0|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (682:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  683|      0|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  684|      0|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  685|      0|                } \
  |  |  686|      0|            } \
  |  |  687|      0|        } \
  |  |  688|  5.55k|}
  ------------------
  695|  5.55k|}
t1.c:opj_t1_dec_sigpass_mqc_generic_vsc:
  715|  6.18k|{
  716|  6.18k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_TRUE, t1->w, t1->h,
  ------------------
  |  |  646|  6.18k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  647|  6.18k|{ \
  |  |  648|  6.18k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  649|  6.18k|        OPJ_UINT32 i, j, k; \
  |  |  650|  6.18k|        register OPJ_INT32 *data = t1->data; \
  |  |  651|  6.18k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  652|  6.18k|        const OPJ_UINT32 l_w = w; \
  |  |  653|  6.18k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  654|  6.18k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  6.18k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  6.18k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  6.18k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  6.18k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  655|  6.18k|        register OPJ_UINT32 v; \
  |  |  656|  6.18k|        one = 1 << bpno; \
  |  |  657|  6.18k|        half = one >> 1; \
  |  |  658|  6.18k|        oneplushalf = one | half; \
  |  |  659|  52.0k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (659:21): [True: 45.9k, False: 6.18k]
  |  |  ------------------
  |  |  660|  2.31M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (660:29): [True: 2.26M, False: 45.9k]
  |  |  ------------------
  |  |  661|  2.26M|                        opj_flag_t flags = *flagsp; \
  |  |  662|  2.26M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (662:29): [True: 1.86M, False: 398k]
  |  |  ------------------
  |  |  663|  1.86M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.86M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.86M|{ \
  |  |  |  |  440|  1.86M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.86M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.86M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.86M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.86M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 708k, False: 1.15M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.86M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   708k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   708k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   708k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   708k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   708k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   708k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   708k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   708k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   708k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   708k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   708k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   708k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   708k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   708k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   708k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   708k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   708k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 617k, False: 91.8k]
  |  |  |  |  ------------------
  |  |  |  |  442|   617k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   617k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   617k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   617k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   617k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   617k|{ \
  |  |  |  |  |  |  140|   617k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   617k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   617k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   617k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   617k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   617k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 141k, False: 475k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   141k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   141k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   141k|{ \
  |  |  |  |  |  |  |  |   57|   141k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 29.7k, False: 112k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  29.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  29.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  29.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   112k|    } else { \
  |  |  |  |  |  |  |  |   62|   112k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   112k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   112k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   112k|    } \
  |  |  |  |  |  |  |  |   66|   141k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   141k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   141k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   141k|{ \
  |  |  |  |  |  |  |  |  128|   232k|    do { \
  |  |  |  |  |  |  |  |  129|   232k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 29.2k, False: 203k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  29.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  29.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  29.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  29.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  29.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  29.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  29.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  29.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 28.7k, False: 508]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  28.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 28.6k, False: 104]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  28.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  28.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  28.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  28.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    104|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    104|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    104|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    104|            } \
  |  |  |  |  |  |  |  |  |  |  118|  28.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    508|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    508|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    508|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    508|        } \
  |  |  |  |  |  |  |  |  |  |  123|  29.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  29.2k|        } \
  |  |  |  |  |  |  |  |  132|   232k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   232k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   232k|        ct--; \
  |  |  |  |  |  |  |  |  135|   232k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 90.5k, False: 141k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   141k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   475k|    } else {  \
  |  |  |  |  |  |  149|   475k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   475k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 150k, False: 324k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   150k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   150k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   150k|{ \
  |  |  |  |  |  |  |  |   45|   150k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 23.4k, False: 127k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  23.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  23.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   127k|    } else { \
  |  |  |  |  |  |  |  |   49|   127k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   127k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   127k|    } \
  |  |  |  |  |  |  |  |   52|   150k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   150k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   150k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   150k|{ \
  |  |  |  |  |  |  |  |  128|   161k|    do { \
  |  |  |  |  |  |  |  |  129|   161k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 20.4k, False: 141k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  20.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  20.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  20.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  20.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  20.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  20.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  20.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  20.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 20.0k, False: 365]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  20.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19.9k, False: 75]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  19.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  19.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  19.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  19.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     75|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     75|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     75|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     75|            } \
  |  |  |  |  |  |  |  |  |  |  118|  20.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    365|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    365|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    365|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    365|        } \
  |  |  |  |  |  |  |  |  |  |  123|  20.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  20.4k|        } \
  |  |  |  |  |  |  |  |  132|   161k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   161k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   161k|        ct--; \
  |  |  |  |  |  |  |  |  135|   161k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.0k, False: 150k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   150k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   324k|        } else { \
  |  |  |  |  |  |  154|   324k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   324k|        } \
  |  |  |  |  |  |  156|   475k|    } \
  |  |  |  |  |  |  157|   617k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   617k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 281k, False: 335k]
  |  |  |  |  ------------------
  |  |  |  |  446|   281k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   281k|                                flags, \
  |  |  |  |  448|   281k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   281k|                                ci); \
  |  |  |  |  450|   281k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   281k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   281k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   281k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   281k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   281k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   281k|{ \
  |  |  |  |  |  |  140|   281k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   281k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   281k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   281k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   281k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   281k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 70.0k, False: 211k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  70.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  70.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  70.0k|{ \
  |  |  |  |  |  |  |  |   57|  70.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 14.1k, False: 55.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  14.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  14.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  14.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  55.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  55.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  55.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  55.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  55.8k|    } \
  |  |  |  |  |  |  |  |   66|  70.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  70.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  70.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  70.0k|{ \
  |  |  |  |  |  |  |  |  128|   115k|    do { \
  |  |  |  |  |  |  |  |  129|   115k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.4k, False: 101k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  14.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  14.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  14.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  14.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  14.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  14.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  14.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  14.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.9k, False: 415]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.9k, False: 82]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     82|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     82|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     82|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     82|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    415|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    415|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    415|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    415|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.4k|        } \
  |  |  |  |  |  |  |  |  132|   115k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   115k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   115k|        ct--; \
  |  |  |  |  |  |  |  |  135|   115k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 45.7k, False: 70.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  70.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   211k|    } else {  \
  |  |  |  |  |  |  149|   211k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   211k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 73.4k, False: 137k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  73.4k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  73.4k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  73.4k|{ \
  |  |  |  |  |  |  |  |   45|  73.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 10.7k, False: 62.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  10.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  10.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  62.6k|    } else { \
  |  |  |  |  |  |  |  |   49|  62.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  62.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  62.6k|    } \
  |  |  |  |  |  |  |  |   52|  73.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  73.4k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  73.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  73.4k|{ \
  |  |  |  |  |  |  |  |  128|  78.1k|    do { \
  |  |  |  |  |  |  |  |  129|  78.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 10.1k, False: 68.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  10.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  10.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  10.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  10.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  10.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  10.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  10.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  10.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.77k, False: 325]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.77k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.71k, False: 63]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.71k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.71k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.71k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.71k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     63|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     63|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     63|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     63|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.77k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    325|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    325|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    325|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    325|        } \
  |  |  |  |  |  |  |  |  |  |  123|  10.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  10.1k|        } \
  |  |  |  |  |  |  |  |  132|  78.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  78.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  78.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  78.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.69k, False: 73.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  73.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   137k|        } else { \
  |  |  |  |  |  |  154|   137k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   137k|        } \
  |  |  |  |  |  |  156|   211k|    } \
  |  |  |  |  |  |  157|   281k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   281k|            v = v ^ spb; \
  |  |  |  |  455|   281k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 140k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  456|   281k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   281k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   281k|{ \
  |  |  |  |  |  |  326|   281k|    /* east */ \
  |  |  |  |  |  |  327|   281k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   281k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   281k| \
  |  |  |  |  |  |  329|   281k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   281k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   281k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   281k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   281k| \
  |  |  |  |  |  |  332|   281k|    /* west */ \
  |  |  |  |  |  |  333|   281k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   281k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   281k| \
  |  |  |  |  |  |  335|   281k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   281k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   281k| \
  |  |  |  |  |  |  343|   281k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   281k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   281k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   281k|        } \
  |  |  |  |  458|   617k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   617k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   617k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   617k|    } \
  |  |  |  |  460|  1.86M|}
  |  |  ------------------
  |  |  664|  1.86M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  1.86M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  666|  1.86M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.86M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.86M|{ \
  |  |  |  |  440|  1.86M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.86M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.86M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.86M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.86M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 697k, False: 1.16M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.86M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   697k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   697k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   697k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   697k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   697k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   697k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   697k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   697k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   697k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   697k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   697k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   697k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   697k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   697k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   697k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   697k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   697k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 665k, False: 32.2k]
  |  |  |  |  ------------------
  |  |  |  |  442|   665k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   665k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   665k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   665k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   665k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   665k|{ \
  |  |  |  |  |  |  140|   665k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   665k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   665k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   665k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   665k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   665k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 152k, False: 512k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   152k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   152k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   152k|{ \
  |  |  |  |  |  |  |  |   57|   152k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 31.9k, False: 120k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  31.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  31.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  31.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   120k|    } else { \
  |  |  |  |  |  |  |  |   62|   120k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   120k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   120k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   120k|    } \
  |  |  |  |  |  |  |  |   66|   152k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   152k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   152k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   152k|{ \
  |  |  |  |  |  |  |  |  128|   249k|    do { \
  |  |  |  |  |  |  |  |  129|   249k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 30.5k, False: 218k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  30.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  30.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  30.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  30.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  30.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  30.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  30.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  30.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 29.9k, False: 553]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  29.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 29.8k, False: 100]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  29.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  29.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  29.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  29.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    100|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    100|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    100|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    100|            } \
  |  |  |  |  |  |  |  |  |  |  118|  29.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    553|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    553|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    553|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    553|        } \
  |  |  |  |  |  |  |  |  |  |  123|  30.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  30.5k|        } \
  |  |  |  |  |  |  |  |  132|   249k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   249k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   249k|        ct--; \
  |  |  |  |  |  |  |  |  135|   249k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 96.9k, False: 152k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   152k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   512k|    } else {  \
  |  |  |  |  |  |  149|   512k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   512k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 160k, False: 351k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   160k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   160k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   160k|{ \
  |  |  |  |  |  |  |  |   45|   160k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 25.2k, False: 135k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  25.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  25.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   135k|    } else { \
  |  |  |  |  |  |  |  |   49|   135k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   135k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   135k|    } \
  |  |  |  |  |  |  |  |   52|   160k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   160k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   160k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   160k|{ \
  |  |  |  |  |  |  |  |  128|   172k|    do { \
  |  |  |  |  |  |  |  |  129|   172k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 21.6k, False: 150k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  21.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  21.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  21.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  21.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  21.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  21.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  21.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  21.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 21.3k, False: 342]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  21.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 21.2k, False: 77]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  21.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  21.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  21.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  21.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     77|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     77|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     77|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     77|            } \
  |  |  |  |  |  |  |  |  |  |  118|  21.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    342|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    342|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    342|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    342|        } \
  |  |  |  |  |  |  |  |  |  |  123|  21.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  21.6k|        } \
  |  |  |  |  |  |  |  |  132|   172k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   172k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   172k|        ct--; \
  |  |  |  |  |  |  |  |  135|   172k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.1k, False: 160k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   160k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   351k|        } else { \
  |  |  |  |  |  |  154|   351k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   351k|        } \
  |  |  |  |  |  |  156|   512k|    } \
  |  |  |  |  |  |  157|   665k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   665k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 295k, False: 369k]
  |  |  |  |  ------------------
  |  |  |  |  446|   295k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   295k|                                flags, \
  |  |  |  |  448|   295k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   295k|                                ci); \
  |  |  |  |  450|   295k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   295k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   295k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   295k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   295k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   295k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   295k|{ \
  |  |  |  |  |  |  140|   295k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   295k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   295k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   295k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   295k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   295k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 70.9k, False: 224k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  70.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  70.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  70.9k|{ \
  |  |  |  |  |  |  |  |   57|  70.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 15.1k, False: 55.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  15.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  15.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  15.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  55.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  55.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  55.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  55.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  55.8k|    } \
  |  |  |  |  |  |  |  |   66|  70.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  70.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  70.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  70.9k|{ \
  |  |  |  |  |  |  |  |  128|   115k|    do { \
  |  |  |  |  |  |  |  |  129|   115k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15.1k, False: 100k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  15.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  15.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  15.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  15.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  15.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  15.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  15.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  15.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14.6k, False: 432]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  14.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.5k, False: 94]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  14.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  14.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  14.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  14.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     94|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     94|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     94|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     94|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    432|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    432|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    432|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    432|        } \
  |  |  |  |  |  |  |  |  |  |  123|  15.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  15.1k|        } \
  |  |  |  |  |  |  |  |  132|   115k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   115k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   115k|        ct--; \
  |  |  |  |  |  |  |  |  135|   115k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 44.4k, False: 70.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  70.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   224k|    } else {  \
  |  |  |  |  |  |  149|   224k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   224k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 77.0k, False: 147k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  77.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  77.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  77.0k|{ \
  |  |  |  |  |  |  |  |   45|  77.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.5k, False: 65.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  65.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  65.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  65.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  65.4k|    } \
  |  |  |  |  |  |  |  |   52|  77.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  77.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  77.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  77.0k|{ \
  |  |  |  |  |  |  |  |  128|  82.3k|    do { \
  |  |  |  |  |  |  |  |  129|  82.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 10.1k, False: 72.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  10.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  10.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  10.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  10.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  10.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  10.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  10.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  10.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.84k, False: 340]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.84k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.78k, False: 58]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.78k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.78k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.78k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.78k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     58|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     58|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     58|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     58|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.84k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    340|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    340|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    340|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    340|        } \
  |  |  |  |  |  |  |  |  |  |  123|  10.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  10.1k|        } \
  |  |  |  |  |  |  |  |  132|  82.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  82.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  82.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  82.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.35k, False: 77.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  77.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   147k|        } else { \
  |  |  |  |  |  |  154|   147k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   147k|        } \
  |  |  |  |  |  |  156|   224k|    } \
  |  |  |  |  |  |  157|   295k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   295k|            v = v ^ spb; \
  |  |  |  |  455|   295k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 143k, False: 152k]
  |  |  |  |  ------------------
  |  |  |  |  456|   295k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   295k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   295k|{ \
  |  |  |  |  |  |  326|   295k|    /* east */ \
  |  |  |  |  |  |  327|   295k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   295k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   295k| \
  |  |  |  |  |  |  329|   295k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   295k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   295k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   295k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   295k| \
  |  |  |  |  |  |  332|   295k|    /* west */ \
  |  |  |  |  |  |  333|   295k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   295k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   295k| \
  |  |  |  |  |  |  335|   295k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   295k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   295k| \
  |  |  |  |  |  |  343|   295k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   295k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   295k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   295k|        } \
  |  |  |  |  458|   665k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   665k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   665k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   665k|    } \
  |  |  |  |  460|  1.86M|}
  |  |  ------------------
  |  |  667|  1.86M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  1.86M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  1.86M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.86M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.86M|{ \
  |  |  |  |  440|  1.86M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.86M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.86M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.86M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.86M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 663k, False: 1.20M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.86M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   663k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   663k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   663k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   663k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   663k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   663k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   663k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   663k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   663k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   663k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   663k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   663k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   663k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   663k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   663k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   663k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   663k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 645k, False: 18.6k]
  |  |  |  |  ------------------
  |  |  |  |  442|   645k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   645k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   645k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   645k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   645k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   645k|{ \
  |  |  |  |  |  |  140|   645k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   645k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   645k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   645k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   645k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   645k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 148k, False: 496k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   148k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   148k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   148k|{ \
  |  |  |  |  |  |  |  |   57|   148k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 31.1k, False: 117k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  31.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  31.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  31.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   117k|    } else { \
  |  |  |  |  |  |  |  |   62|   117k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   117k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   117k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   117k|    } \
  |  |  |  |  |  |  |  |   66|   148k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   148k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   148k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   148k|{ \
  |  |  |  |  |  |  |  |  128|   243k|    do { \
  |  |  |  |  |  |  |  |  129|   243k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 29.6k, False: 213k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  29.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  29.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  29.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  29.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  29.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  29.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  29.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  29.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 29.1k, False: 538]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  29.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 29.0k, False: 91]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  29.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  29.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  29.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  29.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     91|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     91|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     91|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     91|            } \
  |  |  |  |  |  |  |  |  |  |  118|  29.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    538|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    538|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    538|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    538|        } \
  |  |  |  |  |  |  |  |  |  |  123|  29.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  29.6k|        } \
  |  |  |  |  |  |  |  |  132|   243k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   243k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   243k|        ct--; \
  |  |  |  |  |  |  |  |  135|   243k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 94.6k, False: 148k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   148k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   496k|    } else {  \
  |  |  |  |  |  |  149|   496k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   496k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 154k, False: 341k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   154k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   154k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   154k|{ \
  |  |  |  |  |  |  |  |   45|   154k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 24.5k, False: 130k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  24.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  24.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   130k|    } else { \
  |  |  |  |  |  |  |  |   49|   130k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   130k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   130k|    } \
  |  |  |  |  |  |  |  |   52|   154k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   154k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   154k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   154k|{ \
  |  |  |  |  |  |  |  |  128|   165k|    do { \
  |  |  |  |  |  |  |  |  129|   165k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 20.9k, False: 144k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  20.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  20.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  20.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  20.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  20.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  20.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  20.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  20.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 20.5k, False: 376]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  20.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 20.4k, False: 92]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  20.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  20.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  20.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  20.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     92|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     92|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     92|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     92|            } \
  |  |  |  |  |  |  |  |  |  |  118|  20.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    376|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    376|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    376|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    376|        } \
  |  |  |  |  |  |  |  |  |  |  123|  20.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  20.9k|        } \
  |  |  |  |  |  |  |  |  132|   165k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   165k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   165k|        ct--; \
  |  |  |  |  |  |  |  |  135|   165k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 10.8k, False: 154k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   154k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   341k|        } else { \
  |  |  |  |  |  |  154|   341k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   341k|        } \
  |  |  |  |  |  |  156|   496k|    } \
  |  |  |  |  |  |  157|   645k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   645k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 285k, False: 359k]
  |  |  |  |  ------------------
  |  |  |  |  446|   285k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   285k|                                flags, \
  |  |  |  |  448|   285k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   285k|                                ci); \
  |  |  |  |  450|   285k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   285k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   285k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   285k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   285k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   285k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   285k|{ \
  |  |  |  |  |  |  140|   285k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   285k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   285k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   285k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   285k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   285k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 71.5k, False: 214k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  71.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  71.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  71.5k|{ \
  |  |  |  |  |  |  |  |   57|  71.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 14.8k, False: 56.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  14.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  14.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  14.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  56.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  56.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  56.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  56.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  56.7k|    } \
  |  |  |  |  |  |  |  |   66|  71.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  71.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  71.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  71.5k|{ \
  |  |  |  |  |  |  |  |  128|   117k|    do { \
  |  |  |  |  |  |  |  |  129|   117k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.3k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  14.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  14.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  14.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  14.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  14.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  14.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  14.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  14.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.8k, False: 421]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.8k, False: 84]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     84|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     84|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     84|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     84|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    421|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    421|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    421|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    421|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.3k|        } \
  |  |  |  |  |  |  |  |  132|   117k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   117k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   117k|        ct--; \
  |  |  |  |  |  |  |  |  135|   117k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 45.4k, False: 71.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  71.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   214k|    } else {  \
  |  |  |  |  |  |  149|   214k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   214k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 76.6k, False: 137k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  76.6k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  76.6k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  76.6k|{ \
  |  |  |  |  |  |  |  |   45|  76.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.6k, False: 65.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  65.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  65.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  65.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  65.0k|    } \
  |  |  |  |  |  |  |  |   52|  76.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  76.6k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  76.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  76.6k|{ \
  |  |  |  |  |  |  |  |  128|  81.8k|    do { \
  |  |  |  |  |  |  |  |  129|  81.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.71k, False: 72.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.71k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.71k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.71k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.71k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.71k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.71k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.71k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.71k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.42k, False: 297]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.42k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.37k, False: 50]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.37k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.37k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.37k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.37k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     50|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     50|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     50|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     50|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.42k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    297|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    297|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    297|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    297|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.71k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.71k|        } \
  |  |  |  |  |  |  |  |  132|  81.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  81.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  81.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  81.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.12k, False: 76.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  76.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   137k|        } else { \
  |  |  |  |  |  |  154|   137k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   137k|        } \
  |  |  |  |  |  |  156|   214k|    } \
  |  |  |  |  |  |  157|   285k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   285k|            v = v ^ spb; \
  |  |  |  |  455|   285k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 143k, False: 142k]
  |  |  |  |  ------------------
  |  |  |  |  456|   285k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   285k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   285k|{ \
  |  |  |  |  |  |  326|   285k|    /* east */ \
  |  |  |  |  |  |  327|   285k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   285k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   285k| \
  |  |  |  |  |  |  329|   285k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   285k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   285k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   285k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   285k| \
  |  |  |  |  |  |  332|   285k|    /* west */ \
  |  |  |  |  |  |  333|   285k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   285k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   285k| \
  |  |  |  |  |  |  335|   285k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   285k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   285k| \
  |  |  |  |  |  |  343|   285k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   285k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   285k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   285k|        } \
  |  |  |  |  458|   645k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   645k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   645k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   645k|    } \
  |  |  |  |  460|  1.86M|}
  |  |  ------------------
  |  |  670|  1.86M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  1.86M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  1.86M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.86M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.86M|{ \
  |  |  |  |  440|  1.86M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.86M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.86M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.86M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.86M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 664k, False: 1.20M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.86M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   664k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   664k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   664k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   664k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   664k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   664k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   664k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   664k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   664k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   664k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   664k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   664k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   664k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   664k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   664k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   664k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   664k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 614k, False: 50.6k]
  |  |  |  |  ------------------
  |  |  |  |  442|   614k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   614k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   614k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   614k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   614k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   614k|{ \
  |  |  |  |  |  |  140|   614k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   614k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   614k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   614k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   614k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   614k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 137k, False: 476k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   137k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   137k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   137k|{ \
  |  |  |  |  |  |  |  |   57|   137k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 28.0k, False: 109k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  28.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  28.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  28.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   109k|    } else { \
  |  |  |  |  |  |  |  |   62|   109k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   109k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   109k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   109k|    } \
  |  |  |  |  |  |  |  |   66|   137k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   137k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   137k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   137k|{ \
  |  |  |  |  |  |  |  |  128|   226k|    do { \
  |  |  |  |  |  |  |  |  129|   226k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 28.4k, False: 198k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  28.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  28.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  28.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  28.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  28.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  28.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  28.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  28.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 27.9k, False: 480]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  27.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 27.8k, False: 98]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  27.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  27.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  27.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  27.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     98|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     98|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     98|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     98|            } \
  |  |  |  |  |  |  |  |  |  |  118|  27.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    480|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    480|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    480|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    480|        } \
  |  |  |  |  |  |  |  |  |  |  123|  28.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  28.4k|        } \
  |  |  |  |  |  |  |  |  132|   226k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   226k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   226k|        ct--; \
  |  |  |  |  |  |  |  |  135|   226k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 89.2k, False: 137k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   137k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   476k|    } else {  \
  |  |  |  |  |  |  149|   476k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   476k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 145k, False: 331k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   145k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   145k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   145k|{ \
  |  |  |  |  |  |  |  |   45|   145k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 22.5k, False: 122k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  22.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  22.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   122k|    } else { \
  |  |  |  |  |  |  |  |   49|   122k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   122k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   122k|    } \
  |  |  |  |  |  |  |  |   52|   145k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   145k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   145k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   145k|{ \
  |  |  |  |  |  |  |  |  128|   155k|    do { \
  |  |  |  |  |  |  |  |  129|   155k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.8k, False: 135k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 19.5k, False: 305]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  19.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19.5k, False: 71]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  19.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  19.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  19.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  19.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     71|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     71|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     71|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     71|            } \
  |  |  |  |  |  |  |  |  |  |  118|  19.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    305|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    305|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    305|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    305|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.8k|        } \
  |  |  |  |  |  |  |  |  132|   155k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   155k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   155k|        ct--; \
  |  |  |  |  |  |  |  |  135|   155k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9.91k, False: 145k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   145k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   331k|        } else { \
  |  |  |  |  |  |  154|   331k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   331k|        } \
  |  |  |  |  |  |  156|   476k|    } \
  |  |  |  |  |  |  157|   614k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   614k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 276k, False: 338k]
  |  |  |  |  ------------------
  |  |  |  |  446|   276k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   276k|                                flags, \
  |  |  |  |  448|   276k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   276k|                                ci); \
  |  |  |  |  450|   276k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   276k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   276k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   276k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   276k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   276k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   276k|{ \
  |  |  |  |  |  |  140|   276k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   276k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   276k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   276k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   276k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   276k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 67.9k, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  67.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  67.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  67.9k|{ \
  |  |  |  |  |  |  |  |   57|  67.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 14.3k, False: 53.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  14.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  14.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  14.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  53.5k|    } else { \
  |  |  |  |  |  |  |  |   62|  53.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  53.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  53.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  53.5k|    } \
  |  |  |  |  |  |  |  |   66|  67.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  67.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  67.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  67.9k|{ \
  |  |  |  |  |  |  |  |  128|   111k|    do { \
  |  |  |  |  |  |  |  |  129|   111k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.0k, False: 97.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  14.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  14.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  14.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  14.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  14.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  14.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  14.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  14.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.6k, False: 400]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.5k, False: 82]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     82|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     82|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     82|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     82|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    400|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    400|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    400|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    400|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.0k|        } \
  |  |  |  |  |  |  |  |  132|   111k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   111k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   111k|        ct--; \
  |  |  |  |  |  |  |  |  135|   111k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 43.4k, False: 67.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  67.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   208k|    } else {  \
  |  |  |  |  |  |  149|   208k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   208k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 74.2k, False: 133k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  74.2k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  74.2k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  74.2k|{ \
  |  |  |  |  |  |  |  |   45|  74.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 10.9k, False: 63.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  10.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  10.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  63.2k|    } else { \
  |  |  |  |  |  |  |  |   49|  63.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  63.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  63.2k|    } \
  |  |  |  |  |  |  |  |   52|  74.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  74.2k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  74.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  74.2k|{ \
  |  |  |  |  |  |  |  |  128|  78.9k|    do { \
  |  |  |  |  |  |  |  |  129|  78.9k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 10.1k, False: 68.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  10.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  10.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  10.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  10.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  10.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  10.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  10.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  10.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.84k, False: 269]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.84k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.78k, False: 63]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.78k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.78k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.78k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.78k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     63|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     63|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     63|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     63|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.84k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    269|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    269|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    269|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    269|        } \
  |  |  |  |  |  |  |  |  |  |  123|  10.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  10.1k|        } \
  |  |  |  |  |  |  |  |  132|  78.9k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  78.9k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  78.9k|        ct--; \
  |  |  |  |  |  |  |  |  135|  78.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.74k, False: 74.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  74.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   133k|        } else { \
  |  |  |  |  |  |  154|   133k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   133k|        } \
  |  |  |  |  |  |  156|   208k|    } \
  |  |  |  |  |  |  157|   276k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   276k|            v = v ^ spb; \
  |  |  |  |  455|   276k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 140k, False: 136k]
  |  |  |  |  ------------------
  |  |  |  |  456|   276k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   276k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   276k|{ \
  |  |  |  |  |  |  326|   276k|    /* east */ \
  |  |  |  |  |  |  327|   276k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   276k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   276k| \
  |  |  |  |  |  |  329|   276k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   276k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   276k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   276k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   276k| \
  |  |  |  |  |  |  332|   276k|    /* west */ \
  |  |  |  |  |  |  333|   276k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   276k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   276k| \
  |  |  |  |  |  |  335|   276k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   276k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   276k| \
  |  |  |  |  |  |  343|   276k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   276k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   276k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   276k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   276k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   276k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   276k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   276k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   276k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   276k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   276k|    } \
  |  |  |  |  |  |  350|   276k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   276k|        } \
  |  |  |  |  458|   614k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   614k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   614k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   614k|    } \
  |  |  |  |  460|  1.86M|}
  |  |  ------------------
  |  |  673|  1.86M|                                flags, flagsp, flags_stride, data, \
  |  |  674|  1.86M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  675|  1.86M|                            *flagsp = flags; \
  |  |  676|  1.86M|                        } \
  |  |  677|  2.26M|                } \
  |  |  678|  45.9k|        } \
  |  |  679|  6.18k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  6.18k|        mqc->curctx = curctx; \
  |  |  |  |  167|  6.18k|        mqc->c = c; \
  |  |  |  |  168|  6.18k|        mqc->a = a; \
  |  |  |  |  169|  6.18k|        mqc->ct = ct;
  |  |  ------------------
  |  |  680|  6.18k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (680:13): [True: 1.92k, False: 4.25k]
  |  |  ------------------
  |  |  681|   140k|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (681:25): [True: 138k, False: 1.92k]
  |  |  ------------------
  |  |  682|   454k|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (682:29): [True: 316k, False: 138k]
  |  |  ------------------
  |  |  683|   316k|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  684|   316k|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  685|   316k|                } \
  |  |  686|   138k|            } \
  |  |  687|  1.92k|        } \
  |  |  688|  6.18k|}
  ------------------
  717|  6.18k|                                    t1->w + 2U);
  718|  6.18k|}
t1.c:opj_t1_dec_sigpass_mqc_generic_novsc:
  707|  13.8k|{
  708|  13.8k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_FALSE, t1->w, t1->h,
  ------------------
  |  |  646|  13.8k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  647|  13.8k|{ \
  |  |  648|  13.8k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  649|  13.8k|        OPJ_UINT32 i, j, k; \
  |  |  650|  13.8k|        register OPJ_INT32 *data = t1->data; \
  |  |  651|  13.8k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  652|  13.8k|        const OPJ_UINT32 l_w = w; \
  |  |  653|  13.8k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  654|  13.8k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  13.8k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  13.8k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  13.8k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  13.8k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  655|  13.8k|        register OPJ_UINT32 v; \
  |  |  656|  13.8k|        one = 1 << bpno; \
  |  |  657|  13.8k|        half = one >> 1; \
  |  |  658|  13.8k|        oneplushalf = one | half; \
  |  |  659|  91.8k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (659:21): [True: 77.9k, False: 13.8k]
  |  |  ------------------
  |  |  660|  2.64M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (660:29): [True: 2.56M, False: 77.9k]
  |  |  ------------------
  |  |  661|  2.56M|                        opj_flag_t flags = *flagsp; \
  |  |  662|  2.56M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (662:29): [True: 1.78M, False: 776k]
  |  |  ------------------
  |  |  663|  1.78M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.78M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.78M|{ \
  |  |  |  |  440|  1.78M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.78M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.78M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.78M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.78M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 868k, False: 919k]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.78M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   868k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   868k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   868k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   868k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   868k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   868k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   868k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   868k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   868k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   868k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   868k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   868k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   868k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   868k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   868k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   868k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   868k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 709k, False: 159k]
  |  |  |  |  ------------------
  |  |  |  |  442|   709k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   709k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   709k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   709k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   709k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   709k|{ \
  |  |  |  |  |  |  140|   709k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   709k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   709k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   709k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   709k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   709k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 200k, False: 508k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   200k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   200k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   200k|{ \
  |  |  |  |  |  |  |  |   57|   200k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 37.8k, False: 162k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  37.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  37.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  37.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   162k|    } else { \
  |  |  |  |  |  |  |  |   62|   162k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   162k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   162k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   162k|    } \
  |  |  |  |  |  |  |  |   66|   200k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   200k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   200k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   200k|{ \
  |  |  |  |  |  |  |  |  128|   326k|    do { \
  |  |  |  |  |  |  |  |  129|   326k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 40.7k, False: 285k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  40.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  40.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  40.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  40.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  40.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  40.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  40.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  40.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.4k, False: 28.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.2k, False: 157]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    157|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    157|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    157|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    157|            } \
  |  |  |  |  |  |  |  |  |  |  118|  28.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  28.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  28.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  28.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  28.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  40.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  40.7k|        } \
  |  |  |  |  |  |  |  |  132|   326k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   326k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   326k|        ct--; \
  |  |  |  |  |  |  |  |  135|   326k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 125k, False: 200k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   200k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   508k|    } else {  \
  |  |  |  |  |  |  149|   508k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   508k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 194k, False: 314k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   194k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   194k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   194k|{ \
  |  |  |  |  |  |  |  |   45|   194k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 30.7k, False: 163k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  30.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  30.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   163k|    } else { \
  |  |  |  |  |  |  |  |   49|   163k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   163k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   163k|    } \
  |  |  |  |  |  |  |  |   52|   194k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   194k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   194k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   194k|{ \
  |  |  |  |  |  |  |  |  128|   208k|    do { \
  |  |  |  |  |  |  |  |  129|   208k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 26.2k, False: 182k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  26.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  26.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  26.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  26.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  26.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  26.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  26.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  26.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8.60k, False: 17.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  8.60k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.49k, False: 106]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  8.49k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  8.49k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  8.49k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  8.49k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    106|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    106|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    106|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    106|            } \
  |  |  |  |  |  |  |  |  |  |  118|  17.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  17.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  17.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  17.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  17.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  26.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  26.2k|        } \
  |  |  |  |  |  |  |  |  132|   208k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   208k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   208k|        ct--; \
  |  |  |  |  |  |  |  |  135|   208k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 14.2k, False: 194k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   194k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   314k|        } else { \
  |  |  |  |  |  |  154|   314k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   314k|        } \
  |  |  |  |  |  |  156|   508k|    } \
  |  |  |  |  |  |  157|   709k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   709k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 266k, False: 442k]
  |  |  |  |  ------------------
  |  |  |  |  446|   266k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   266k|                                flags, \
  |  |  |  |  448|   266k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   266k|                                ci); \
  |  |  |  |  450|   266k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   266k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   266k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   266k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   266k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   266k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   266k|{ \
  |  |  |  |  |  |  140|   266k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   266k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   266k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   266k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   266k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   266k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 87.8k, False: 178k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  87.8k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  87.8k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  87.8k|{ \
  |  |  |  |  |  |  |  |   57|  87.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.7k, False: 69.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  69.1k|    } else { \
  |  |  |  |  |  |  |  |   62|  69.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  69.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  69.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  69.1k|    } \
  |  |  |  |  |  |  |  |   66|  87.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  87.8k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  87.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  87.8k|{ \
  |  |  |  |  |  |  |  |  128|   132k|    do { \
  |  |  |  |  |  |  |  |  129|   132k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.3k, False: 116k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.90k, False: 10.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.90k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.83k, False: 68]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.83k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.83k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.83k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.83k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     68|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     68|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     68|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     68|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.3k|        } \
  |  |  |  |  |  |  |  |  132|   132k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   132k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   132k|        ct--; \
  |  |  |  |  |  |  |  |  135|   132k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 45.1k, False: 87.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  87.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   178k|    } else {  \
  |  |  |  |  |  |  149|   178k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   178k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 82.8k, False: 95.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  82.8k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  82.8k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  82.8k|{ \
  |  |  |  |  |  |  |  |   45|  82.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 15.7k, False: 67.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  15.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  15.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  67.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  67.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  67.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  67.0k|    } \
  |  |  |  |  |  |  |  |   52|  82.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  82.8k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  82.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  82.8k|{ \
  |  |  |  |  |  |  |  |  128|  89.8k|    do { \
  |  |  |  |  |  |  |  |  129|  89.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.6k, False: 78.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  11.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  11.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  11.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  11.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  11.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  11.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  11.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  11.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.36k, False: 7.25k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.36k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.33k, False: 31]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.33k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.33k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.33k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.33k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     31|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     31|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     31|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     31|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.25k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.25k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.25k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.25k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.25k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.6k|        } \
  |  |  |  |  |  |  |  |  132|  89.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  89.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  89.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  89.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.02k, False: 82.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  82.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  95.4k|        } else { \
  |  |  |  |  |  |  154|  95.4k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  95.4k|        } \
  |  |  |  |  |  |  156|   178k|    } \
  |  |  |  |  |  |  157|   266k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   266k|            v = v ^ spb; \
  |  |  |  |  455|   266k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 133k, False: 132k]
  |  |  |  |  ------------------
  |  |  |  |  456|   266k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   266k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   266k|{ \
  |  |  |  |  |  |  326|   266k|    /* east */ \
  |  |  |  |  |  |  327|   266k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   266k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   266k| \
  |  |  |  |  |  |  329|   266k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   266k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   266k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   266k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   266k| \
  |  |  |  |  |  |  332|   266k|    /* west */ \
  |  |  |  |  |  |  333|   266k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   266k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   266k| \
  |  |  |  |  |  |  335|   266k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   266k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|   266k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|   266k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|   266k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|   266k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|   266k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|   266k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|   266k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|   266k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|   266k|    } \
  |  |  |  |  |  |  342|   266k| \
  |  |  |  |  |  |  343|   266k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   266k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   266k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   266k|        } \
  |  |  |  |  458|   709k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   709k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   709k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   709k|    } \
  |  |  |  |  460|  1.78M|}
  |  |  ------------------
  |  |  664|  1.78M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  1.78M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  666|  1.78M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.78M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.78M|{ \
  |  |  |  |  440|  1.78M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.78M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.78M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.78M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.78M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 856k, False: 931k]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.78M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   856k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   856k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   856k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   856k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   856k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   856k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   856k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   856k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   856k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   856k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   856k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   856k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   856k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   856k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   856k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   856k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   856k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 724k, False: 131k]
  |  |  |  |  ------------------
  |  |  |  |  442|   724k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   724k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   724k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   724k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   724k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   724k|{ \
  |  |  |  |  |  |  140|   724k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   724k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   724k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   724k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   724k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   724k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 206k, False: 517k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   206k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   206k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   206k|{ \
  |  |  |  |  |  |  |  |   57|   206k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 41.4k, False: 165k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  41.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  41.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  41.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   165k|    } else { \
  |  |  |  |  |  |  |  |   62|   165k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   165k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   165k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   165k|    } \
  |  |  |  |  |  |  |  |   66|   206k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   206k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   206k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   206k|{ \
  |  |  |  |  |  |  |  |  128|   333k|    do { \
  |  |  |  |  |  |  |  |  129|   333k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 41.4k, False: 292k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  41.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  41.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  41.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  41.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  41.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  41.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  41.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  41.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.1k, False: 28.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.0k, False: 155]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    155|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    155|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    155|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    155|            } \
  |  |  |  |  |  |  |  |  |  |  118|  28.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  28.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  28.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  28.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  28.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  41.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  41.4k|        } \
  |  |  |  |  |  |  |  |  132|   333k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   333k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   333k|        ct--; \
  |  |  |  |  |  |  |  |  135|   333k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 126k, False: 206k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   206k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   517k|    } else {  \
  |  |  |  |  |  |  149|   517k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   517k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 199k, False: 318k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   199k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   199k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   199k|{ \
  |  |  |  |  |  |  |  |   45|   199k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 33.0k, False: 166k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  33.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  33.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   166k|    } else { \
  |  |  |  |  |  |  |  |   49|   166k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   166k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   166k|    } \
  |  |  |  |  |  |  |  |   52|   199k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   199k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   199k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   199k|{ \
  |  |  |  |  |  |  |  |  128|   215k|    do { \
  |  |  |  |  |  |  |  |  129|   215k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 26.4k, False: 188k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  26.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  26.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  26.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  26.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  26.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  26.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  26.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  26.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8.93k, False: 17.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  8.93k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.83k, False: 100]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  8.83k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  8.83k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  8.83k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  8.83k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    100|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    100|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    100|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    100|            } \
  |  |  |  |  |  |  |  |  |  |  118|  17.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  17.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  17.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  17.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  17.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  26.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  26.4k|        } \
  |  |  |  |  |  |  |  |  132|   215k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   215k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   215k|        ct--; \
  |  |  |  |  |  |  |  |  135|   215k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 15.3k, False: 199k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   199k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   318k|        } else { \
  |  |  |  |  |  |  154|   318k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   318k|        } \
  |  |  |  |  |  |  156|   517k|    } \
  |  |  |  |  |  |  157|   724k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   724k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 269k, False: 455k]
  |  |  |  |  ------------------
  |  |  |  |  446|   269k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   269k|                                flags, \
  |  |  |  |  448|   269k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   269k|                                ci); \
  |  |  |  |  450|   269k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   269k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   269k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   269k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   269k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   269k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   269k|{ \
  |  |  |  |  |  |  140|   269k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   269k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   269k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   269k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   269k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   269k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 87.6k, False: 182k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  87.6k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  87.6k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  87.6k|{ \
  |  |  |  |  |  |  |  |   57|  87.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.8k, False: 68.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  68.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  68.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  68.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  68.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  68.8k|    } \
  |  |  |  |  |  |  |  |   66|  87.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  87.6k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  87.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  87.6k|{ \
  |  |  |  |  |  |  |  |  128|   132k|    do { \
  |  |  |  |  |  |  |  |  129|   132k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.5k, False: 116k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.20k, False: 10.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.20k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.10k, False: 94]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.10k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.10k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.10k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.10k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     94|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     94|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     94|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     94|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.5k|        } \
  |  |  |  |  |  |  |  |  132|   132k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   132k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   132k|        ct--; \
  |  |  |  |  |  |  |  |  135|   132k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 45.1k, False: 87.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  87.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   182k|    } else {  \
  |  |  |  |  |  |  149|   182k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   182k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 85.3k, False: 96.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  85.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  85.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  85.3k|{ \
  |  |  |  |  |  |  |  |   45|  85.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 15.6k, False: 69.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  15.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  15.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  69.7k|    } else { \
  |  |  |  |  |  |  |  |   49|  69.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  69.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  69.7k|    } \
  |  |  |  |  |  |  |  |   52|  85.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  85.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  85.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  85.3k|{ \
  |  |  |  |  |  |  |  |  128|  92.5k|    do { \
  |  |  |  |  |  |  |  |  129|  92.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.5k, False: 81.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  11.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  11.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  11.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  11.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  11.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  11.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  11.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  11.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.51k, False: 7.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.51k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.45k, False: 53]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.45k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.45k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.45k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.45k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     53|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     53|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     53|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     53|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.00k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.00k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.00k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.00k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.00k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.5k|        } \
  |  |  |  |  |  |  |  |  132|  92.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  92.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  92.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  92.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.16k, False: 85.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  85.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  96.6k|        } else { \
  |  |  |  |  |  |  154|  96.6k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  96.6k|        } \
  |  |  |  |  |  |  156|   182k|    } \
  |  |  |  |  |  |  157|   269k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   269k|            v = v ^ spb; \
  |  |  |  |  455|   269k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 134k, False: 135k]
  |  |  |  |  ------------------
  |  |  |  |  456|   269k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   269k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   269k|{ \
  |  |  |  |  |  |  326|   269k|    /* east */ \
  |  |  |  |  |  |  327|   269k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   269k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   269k| \
  |  |  |  |  |  |  329|   269k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   269k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   269k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   269k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   269k| \
  |  |  |  |  |  |  332|   269k|    /* west */ \
  |  |  |  |  |  |  333|   269k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   269k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   269k| \
  |  |  |  |  |  |  335|   269k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   269k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   269k| \
  |  |  |  |  |  |  343|   269k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   269k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   269k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   269k|        } \
  |  |  |  |  458|   724k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   724k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   724k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   724k|    } \
  |  |  |  |  460|  1.78M|}
  |  |  ------------------
  |  |  667|  1.78M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  1.78M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  1.78M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.78M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.78M|{ \
  |  |  |  |  440|  1.78M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.78M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.78M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.78M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.78M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 841k, False: 946k]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.78M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   841k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   841k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   841k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   841k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   841k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   841k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   841k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   841k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   841k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   841k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   841k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   841k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   841k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   841k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   841k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   841k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   841k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 725k, False: 115k]
  |  |  |  |  ------------------
  |  |  |  |  442|   725k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   725k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   725k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   725k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   725k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   725k|{ \
  |  |  |  |  |  |  140|   725k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   725k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   725k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   725k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   725k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   725k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 203k, False: 521k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   203k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   203k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   203k|{ \
  |  |  |  |  |  |  |  |   57|   203k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 39.0k, False: 164k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  39.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  39.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  39.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   164k|    } else { \
  |  |  |  |  |  |  |  |   62|   164k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   164k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   164k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   164k|    } \
  |  |  |  |  |  |  |  |   66|   203k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   203k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   203k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   203k|{ \
  |  |  |  |  |  |  |  |  128|   331k|    do { \
  |  |  |  |  |  |  |  |  129|   331k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 41.8k, False: 289k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  41.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  41.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  41.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  41.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  41.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  41.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  41.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  41.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.2k, False: 28.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.0k, False: 185]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    185|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    185|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    185|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    185|            } \
  |  |  |  |  |  |  |  |  |  |  118|  28.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  28.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  28.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  28.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  28.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  41.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  41.8k|        } \
  |  |  |  |  |  |  |  |  132|   331k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   331k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   331k|        ct--; \
  |  |  |  |  |  |  |  |  135|   331k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 127k, False: 203k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   203k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   521k|    } else {  \
  |  |  |  |  |  |  149|   521k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   521k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 199k, False: 321k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   199k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   199k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   199k|{ \
  |  |  |  |  |  |  |  |   45|   199k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 31.8k, False: 167k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  31.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  31.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   167k|    } else { \
  |  |  |  |  |  |  |  |   49|   167k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   167k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   167k|    } \
  |  |  |  |  |  |  |  |   52|   199k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   199k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   199k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   199k|{ \
  |  |  |  |  |  |  |  |  128|   214k|    do { \
  |  |  |  |  |  |  |  |  129|   214k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 27.3k, False: 187k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  27.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  27.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  27.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  27.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  27.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  27.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  27.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  27.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.37k, False: 17.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.37k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.26k, False: 108]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.26k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.26k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.26k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.26k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    108|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    108|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    108|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    108|            } \
  |  |  |  |  |  |  |  |  |  |  118|  17.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  17.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  17.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  17.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  17.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  27.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  27.3k|        } \
  |  |  |  |  |  |  |  |  132|   214k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   214k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   214k|        ct--; \
  |  |  |  |  |  |  |  |  135|   214k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 14.5k, False: 199k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   199k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   321k|        } else { \
  |  |  |  |  |  |  154|   321k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   321k|        } \
  |  |  |  |  |  |  156|   521k|    } \
  |  |  |  |  |  |  157|   725k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   725k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 269k, False: 455k]
  |  |  |  |  ------------------
  |  |  |  |  446|   269k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   269k|                                flags, \
  |  |  |  |  448|   269k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   269k|                                ci); \
  |  |  |  |  450|   269k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   269k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   269k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   269k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   269k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   269k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   269k|{ \
  |  |  |  |  |  |  140|   269k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   269k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   269k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   269k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   269k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   269k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 89.8k, False: 179k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  89.8k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  89.8k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  89.8k|{ \
  |  |  |  |  |  |  |  |   57|  89.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.9k, False: 70.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  70.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  70.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  70.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  70.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  70.9k|    } \
  |  |  |  |  |  |  |  |   66|  89.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  89.8k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  89.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  89.8k|{ \
  |  |  |  |  |  |  |  |  128|   136k|    do { \
  |  |  |  |  |  |  |  |  129|   136k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.8k, False: 120k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.32k, False: 10.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.32k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.24k, False: 82]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.24k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.24k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.24k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.24k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     82|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     82|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     82|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     82|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.8k|        } \
  |  |  |  |  |  |  |  |  132|   136k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   136k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   136k|        ct--; \
  |  |  |  |  |  |  |  |  135|   136k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 47.0k, False: 89.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  89.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   179k|    } else {  \
  |  |  |  |  |  |  149|   179k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   179k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 84.0k, False: 95.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  84.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  84.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  84.0k|{ \
  |  |  |  |  |  |  |  |   45|  84.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 16.0k, False: 68.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  16.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  16.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  68.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  68.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  68.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  68.0k|    } \
  |  |  |  |  |  |  |  |   52|  84.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  84.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  84.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  84.0k|{ \
  |  |  |  |  |  |  |  |  128|  91.3k|    do { \
  |  |  |  |  |  |  |  |  129|  91.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.2k, False: 80.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  11.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  11.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  11.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  11.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  11.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  11.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  11.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  11.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.48k, False: 6.76k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.48k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.45k, False: 34]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.45k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.45k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.45k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.45k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     34|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     34|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     34|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     34|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.76k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.76k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.76k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.76k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.76k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.2k|        } \
  |  |  |  |  |  |  |  |  132|  91.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  91.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  91.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  91.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.31k, False: 84.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  84.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  95.7k|        } else { \
  |  |  |  |  |  |  154|  95.7k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  95.7k|        } \
  |  |  |  |  |  |  156|   179k|    } \
  |  |  |  |  |  |  157|   269k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   269k|            v = v ^ spb; \
  |  |  |  |  455|   269k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 132k, False: 136k]
  |  |  |  |  ------------------
  |  |  |  |  456|   269k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   269k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   269k|{ \
  |  |  |  |  |  |  326|   269k|    /* east */ \
  |  |  |  |  |  |  327|   269k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   269k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   269k| \
  |  |  |  |  |  |  329|   269k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   269k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   269k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   269k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   269k| \
  |  |  |  |  |  |  332|   269k|    /* west */ \
  |  |  |  |  |  |  333|   269k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   269k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   269k| \
  |  |  |  |  |  |  335|   269k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   269k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   269k| \
  |  |  |  |  |  |  343|   269k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   269k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   269k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   269k|        } \
  |  |  |  |  458|   725k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   725k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   725k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   725k|    } \
  |  |  |  |  460|  1.78M|}
  |  |  ------------------
  |  |  670|  1.78M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  1.78M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  1.78M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.78M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.78M|{ \
  |  |  |  |  440|  1.78M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.78M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.78M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.78M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.78M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 834k, False: 952k]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.78M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   834k|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|   834k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   834k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   834k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   834k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  151|   834k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   834k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  152|   834k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   834k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   834k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   834k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|   834k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   834k|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|   834k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   834k|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|   834k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   834k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 694k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  442|   694k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   694k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   694k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   694k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   694k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   694k|{ \
  |  |  |  |  |  |  140|   694k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   694k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   694k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   694k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   694k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   694k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 198k, False: 495k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   198k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   198k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   198k|{ \
  |  |  |  |  |  |  |  |   57|   198k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 36.6k, False: 162k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  36.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  36.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  36.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   162k|    } else { \
  |  |  |  |  |  |  |  |   62|   162k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   162k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   162k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   162k|    } \
  |  |  |  |  |  |  |  |   66|   198k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   198k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   198k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   198k|{ \
  |  |  |  |  |  |  |  |  128|   326k|    do { \
  |  |  |  |  |  |  |  |  129|   326k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 40.5k, False: 285k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  40.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  40.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  40.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  40.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  40.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  40.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  40.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  40.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.5k, False: 27.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.4k, False: 140]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    140|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    140|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    140|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    140|            } \
  |  |  |  |  |  |  |  |  |  |  118|  27.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  27.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  27.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  27.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  27.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  40.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  40.5k|        } \
  |  |  |  |  |  |  |  |  132|   326k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   326k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   326k|        ct--; \
  |  |  |  |  |  |  |  |  135|   326k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 127k, False: 198k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   198k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   495k|    } else {  \
  |  |  |  |  |  |  149|   495k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   495k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 190k, False: 305k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   190k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   190k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   190k|{ \
  |  |  |  |  |  |  |  |   45|   190k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 30.3k, False: 160k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  30.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  30.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   160k|    } else { \
  |  |  |  |  |  |  |  |   49|   160k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   160k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   160k|    } \
  |  |  |  |  |  |  |  |   52|   190k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   190k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   190k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   190k|{ \
  |  |  |  |  |  |  |  |  128|   204k|    do { \
  |  |  |  |  |  |  |  |  129|   204k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 25.3k, False: 178k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  25.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  25.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  25.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  25.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  25.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  25.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  25.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  25.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8.58k, False: 16.7k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  8.58k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.48k, False: 97]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  8.48k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  8.48k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  8.48k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  8.48k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     97|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     97|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     97|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     97|            } \
  |  |  |  |  |  |  |  |  |  |  118|  16.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  16.7k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  16.7k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  16.7k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  16.7k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  25.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  25.3k|        } \
  |  |  |  |  |  |  |  |  132|   204k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   204k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   204k|        ct--; \
  |  |  |  |  |  |  |  |  135|   204k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 13.8k, False: 190k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   190k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   305k|        } else { \
  |  |  |  |  |  |  154|   305k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   305k|        } \
  |  |  |  |  |  |  156|   495k|    } \
  |  |  |  |  |  |  157|   694k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   694k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 265k, False: 429k]
  |  |  |  |  ------------------
  |  |  |  |  446|   265k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   265k|                                flags, \
  |  |  |  |  448|   265k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   265k|                                ci); \
  |  |  |  |  450|   265k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   265k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   265k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   265k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   265k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   265k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   265k|{ \
  |  |  |  |  |  |  140|   265k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   265k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   265k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   265k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   265k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   265k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 87.8k, False: 177k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  87.8k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  87.8k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  87.8k|{ \
  |  |  |  |  |  |  |  |   57|  87.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.5k, False: 69.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  69.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  69.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  69.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  69.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  69.2k|    } \
  |  |  |  |  |  |  |  |   66|  87.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  87.8k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  87.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  87.8k|{ \
  |  |  |  |  |  |  |  |  128|   134k|    do { \
  |  |  |  |  |  |  |  |  129|   134k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.9k, False: 117k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.29k, False: 10.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.29k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.22k, False: 70]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.22k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.22k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.22k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.22k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     70|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     70|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     70|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     70|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.9k|        } \
  |  |  |  |  |  |  |  |  132|   134k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   134k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   134k|        ct--; \
  |  |  |  |  |  |  |  |  135|   134k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 46.3k, False: 87.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  87.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   177k|    } else {  \
  |  |  |  |  |  |  149|   177k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   177k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 83.1k, False: 94.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  83.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  83.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  83.1k|{ \
  |  |  |  |  |  |  |  |   45|  83.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 15.8k, False: 67.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  15.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  15.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  67.3k|    } else { \
  |  |  |  |  |  |  |  |   49|  67.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  67.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  67.3k|    } \
  |  |  |  |  |  |  |  |   52|  83.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  83.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  83.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  83.1k|{ \
  |  |  |  |  |  |  |  |  128|  90.5k|    do { \
  |  |  |  |  |  |  |  |  129|  90.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.6k, False: 78.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  11.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  11.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  11.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  11.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  11.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  11.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  11.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  11.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.61k, False: 6.99k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.61k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.54k, False: 78]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.54k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.54k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.54k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.54k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     78|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     78|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     78|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     78|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.99k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.99k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.99k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.99k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.99k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.6k|        } \
  |  |  |  |  |  |  |  |  132|  90.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  90.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  90.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  90.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.39k, False: 83.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  83.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  94.2k|        } else { \
  |  |  |  |  |  |  154|  94.2k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  94.2k|        } \
  |  |  |  |  |  |  156|   177k|    } \
  |  |  |  |  |  |  157|   265k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   265k|            v = v ^ spb; \
  |  |  |  |  455|   265k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 131k, False: 134k]
  |  |  |  |  ------------------
  |  |  |  |  456|   265k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   265k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   265k|{ \
  |  |  |  |  |  |  326|   265k|    /* east */ \
  |  |  |  |  |  |  327|   265k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   265k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   265k| \
  |  |  |  |  |  |  329|   265k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   265k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   265k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   265k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   265k| \
  |  |  |  |  |  |  332|   265k|    /* west */ \
  |  |  |  |  |  |  333|   265k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   265k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   265k| \
  |  |  |  |  |  |  335|   265k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   265k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   265k| \
  |  |  |  |  |  |  343|   265k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   265k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   265k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   265k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   265k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   265k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   265k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   265k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   265k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   265k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   265k|    } \
  |  |  |  |  |  |  350|   265k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   265k|        } \
  |  |  |  |  458|   694k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   694k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   694k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   694k|    } \
  |  |  |  |  460|  1.78M|}
  |  |  ------------------
  |  |  673|  1.78M|                                flags, flagsp, flags_stride, data, \
  |  |  674|  1.78M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  675|  1.78M|                            *flagsp = flags; \
  |  |  676|  1.78M|                        } \
  |  |  677|  2.56M|                } \
  |  |  678|  77.9k|        } \
  |  |  679|  13.8k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  13.8k|        mqc->curctx = curctx; \
  |  |  |  |  167|  13.8k|        mqc->c = c; \
  |  |  |  |  168|  13.8k|        mqc->a = a; \
  |  |  |  |  169|  13.8k|        mqc->ct = ct;
  |  |  ------------------
  |  |  680|  13.8k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (680:13): [True: 663, False: 13.2k]
  |  |  ------------------
  |  |  681|   173k|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (681:25): [True: 173k, False: 663]
  |  |  ------------------
  |  |  682|   519k|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (682:29): [True: 346k, False: 173k]
  |  |  ------------------
  |  |  683|   346k|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  684|   346k|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  685|   346k|                } \
  |  |  686|   173k|            } \
  |  |  687|    663|        } \
  |  |  688|  13.8k|}
  ------------------
  709|  13.8k|                                    t1->w + 2U);
  710|  13.8k|}
t1.c:opj_t1_dec_refpass_raw:
  928|    934|{
  929|    934|    OPJ_INT32 one, poshalf;
  930|    934|    OPJ_UINT32 i, j, k;
  931|    934|    OPJ_INT32 *data = t1->data;
  932|    934|    opj_flag_t *flagsp = &T1_FLAGS(0, 0);
  ------------------
  |  |   63|    934|#define T1_FLAGS(x, y) (t1->flags[x + 1 + ((y / 4) + 1) * (t1->w+2)])
  ------------------
  933|    934|    const OPJ_UINT32 l_w = t1->w;
  934|    934|    one = 1 << bpno;
  935|    934|    poshalf = one >> 1;
  936|  4.86k|    for (k = 0; k < (t1->h & ~3U); k += 4, flagsp += 2, data += 3 * l_w) {
  ------------------
  |  Branch (936:17): [True: 3.93k, False: 934]
  ------------------
  937|   362k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) {
  ------------------
  |  Branch (937:21): [True: 358k, False: 3.93k]
  ------------------
  938|   358k|            opj_flag_t flags = *flagsp;
  939|   358k|            if (flags != 0) {
  ------------------
  |  Branch (939:17): [True: 296k, False: 61.8k]
  ------------------
  940|   296k|                opj_t1_dec_refpass_step_raw(
  941|   296k|                    t1,
  942|   296k|                    flagsp,
  943|   296k|                    data,
  944|   296k|                    poshalf,
  945|   296k|                    0U);
  946|   296k|                opj_t1_dec_refpass_step_raw(
  947|   296k|                    t1,
  948|   296k|                    flagsp,
  949|   296k|                    data + l_w,
  950|   296k|                    poshalf,
  951|   296k|                    1U);
  952|   296k|                opj_t1_dec_refpass_step_raw(
  953|   296k|                    t1,
  954|   296k|                    flagsp,
  955|   296k|                    data + 2 * l_w,
  956|   296k|                    poshalf,
  957|   296k|                    2U);
  958|   296k|                opj_t1_dec_refpass_step_raw(
  959|   296k|                    t1,
  960|   296k|                    flagsp,
  961|   296k|                    data + 3 * l_w,
  962|   296k|                    poshalf,
  963|   296k|                    3U);
  964|   296k|            }
  965|   358k|        }
  966|  3.93k|    }
  967|    934|    if (k < t1->h) {
  ------------------
  |  Branch (967:9): [True: 417, False: 517]
  ------------------
  968|  85.3k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) {
  ------------------
  |  Branch (968:21): [True: 84.9k, False: 417]
  ------------------
  969|   267k|            for (j = 0; j < t1->h - k; ++j) {
  ------------------
  |  Branch (969:25): [True: 182k, False: 84.9k]
  ------------------
  970|   182k|                opj_t1_dec_refpass_step_raw(
  971|   182k|                    t1,
  972|   182k|                    flagsp,
  973|   182k|                    data + j * l_w,
  974|   182k|                    poshalf,
  975|   182k|                    j);
  976|   182k|            }
  977|  84.9k|        }
  978|    417|    }
  979|    934|}
t1.c:opj_t1_dec_refpass_step_raw:
  773|  1.36M|{
  774|  1.36M|    OPJ_UINT32 v;
  775|       |
  776|  1.36M|    opj_mqc_t *mqc = &(t1->mqc);       /* RAW component */
  777|       |
  778|  1.36M|    if ((*flagsp & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) ==
  ------------------
  |  |  153|  1.36M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  ------------------
  |  |  |  |   95|  1.36M|#define T1_SIGMA_4  (1U << 4)
  |  |  ------------------
  ------------------
                  if ((*flagsp & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) ==
  ------------------
  |  |  163|  1.36M|#define T1_PI_THIS    T1_PI_0
  |  |  ------------------
  |  |  |  |  115|  1.36M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  ------------------
  |  Branch (778:9): [True: 1.25M, False: 109k]
  ------------------
  779|  1.36M|            (T1_SIGMA_THIS << (ci * 3U))) {
  ------------------
  |  |  153|  1.36M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  ------------------
  |  |  |  |   95|  1.36M|#define T1_SIGMA_4  (1U << 4)
  |  |  ------------------
  ------------------
  780|  1.25M|        v = opj_mqc_raw_decode(mqc);
  781|  1.25M|        *datap += (v ^ (*datap < 0)) ? poshalf : -poshalf;
  ------------------
  |  Branch (781:19): [True: 458k, False: 800k]
  ------------------
  782|  1.25M|        *flagsp |= T1_MU_THIS << (ci * 3U);
  ------------------
  |  |  162|  1.25M|#define T1_MU_THIS    T1_MU_0
  |  |  ------------------
  |  |  |  |  114|  1.25M|#define T1_MU_0     (1U << 20)
  |  |  ------------------
  ------------------
  783|  1.25M|    }
  784|  1.36M|}
t1.c:opj_t1_dec_refpass_mqc:
 1040|  25.6k|{
 1041|  25.6k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (1041:9): [True: 8.44k, False: 17.2k]
  |  Branch (1041:24): [True: 7.54k, False: 898]
  ------------------
 1042|  7.54k|        opj_t1_dec_refpass_mqc_64x64(t1, bpno);
 1043|  18.1k|    } else {
 1044|  18.1k|        opj_t1_dec_refpass_mqc_generic(t1, bpno);
 1045|  18.1k|    }
 1046|  25.6k|}
t1.c:opj_t1_dec_refpass_mqc_64x64:
 1026|  7.54k|{
 1027|  7.54k|    opj_t1_dec_refpass_mqc_internal(t1, bpno, 64, 64, 66);
  ------------------
  |  |  981|  7.54k|#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) \
  |  |  982|  7.54k|{ \
  |  |  983|  7.54k|        OPJ_INT32 one, poshalf; \
  |  |  984|  7.54k|        OPJ_UINT32 i, j, k; \
  |  |  985|  7.54k|        register OPJ_INT32 *data = t1->data; \
  |  |  986|  7.54k|        register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  |  987|  7.54k|        const OPJ_UINT32 l_w = w; \
  |  |  988|  7.54k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  989|  7.54k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  7.54k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  7.54k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  7.54k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  7.54k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  990|  7.54k|        register OPJ_UINT32 v; \
  |  |  991|  7.54k|        one = 1 << bpno; \
  |  |  992|  7.54k|        poshalf = one >> 1; \
  |  |  993|   128k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (993:21): [True: 120k, False: 7.54k]
  |  |  ------------------
  |  |  994|  7.84M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (994:29): [True: 7.72M, False: 120k]
  |  |  ------------------
  |  |  995|  7.72M|                        opj_flag_t flags = *flagsp; \
  |  |  996|  7.72M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (996:29): [True: 4.30M, False: 3.41M]
  |  |  ------------------
  |  |  997|  4.30M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  4.30M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  4.30M|{ \
  |  |  |  |  789|  4.30M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.30M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.30M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  4.30M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  4.30M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 2.38M, False: 1.92M]
  |  |  |  |  ------------------
  |  |  |  |  790|  4.30M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.30M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.30M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  2.38M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  2.38M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  2.38M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  2.38M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.38M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.38M|{ \
  |  |  |  |  |  |  140|  2.38M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.38M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.38M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.38M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.38M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.38M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 592k, False: 1.79M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   592k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   592k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   592k|{ \
  |  |  |  |  |  |  |  |   57|   592k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 132k, False: 459k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   132k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   132k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   132k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   459k|    } else { \
  |  |  |  |  |  |  |  |   62|   459k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   459k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   459k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   459k|    } \
  |  |  |  |  |  |  |  |   66|   592k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   592k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   592k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   592k|{ \
  |  |  |  |  |  |  |  |  128|   894k|    do { \
  |  |  |  |  |  |  |  |  129|   894k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 111k, False: 782k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   111k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   111k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   111k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   111k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   111k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   111k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   111k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   111k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 61.9k, False: 49.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  61.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 61.7k, False: 200]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  61.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  61.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  61.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  61.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    200|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    200|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    200|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    200|            } \
  |  |  |  |  |  |  |  |  |  |  118|  61.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  49.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  49.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  49.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  49.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   111k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   111k|        } \
  |  |  |  |  |  |  |  |  132|   894k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   894k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   894k|        ct--; \
  |  |  |  |  |  |  |  |  135|   894k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 302k, False: 592k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   592k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.79M|    } else {  \
  |  |  |  |  |  |  149|  1.79M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.79M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 572k, False: 1.22M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   572k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   572k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   572k|{ \
  |  |  |  |  |  |  |  |   45|   572k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 117k, False: 455k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   117k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   117k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   455k|    } else { \
  |  |  |  |  |  |  |  |   49|   455k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   455k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   455k|    } \
  |  |  |  |  |  |  |  |   52|   572k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   572k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   572k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   572k|{ \
  |  |  |  |  |  |  |  |  128|   618k|    do { \
  |  |  |  |  |  |  |  |  129|   618k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 77.9k, False: 540k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  77.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  77.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  77.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  77.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  77.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  77.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  77.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  77.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 43.2k, False: 34.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  43.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 43.0k, False: 218]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  43.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  43.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  43.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  43.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    218|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    218|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    218|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    218|            } \
  |  |  |  |  |  |  |  |  |  |  118|  43.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  34.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  34.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  34.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  34.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  77.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  77.9k|        } \
  |  |  |  |  |  |  |  |  132|   618k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   618k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   618k|        ct--; \
  |  |  |  |  |  |  |  |  135|   618k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 46.0k, False: 572k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   572k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.22M|        } else { \
  |  |  |  |  |  |  154|  1.22M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.22M|        } \
  |  |  |  |  |  |  156|  1.79M|    } \
  |  |  |  |  |  |  157|  2.38M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  2.38M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 1.19M, False: 1.19M]
  |  |  |  |  ------------------
  |  |  |  |  795|  2.38M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  2.38M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  2.38M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  2.38M|    } \
  |  |  |  |  797|  4.30M|}
  |  |  ------------------
  |  |  998|  4.30M|                                flags, data, l_w, 0, \
  |  |  999|  4.30M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1000|  4.30M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  4.30M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  4.30M|{ \
  |  |  |  |  789|  4.30M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.30M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.30M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  4.30M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  4.30M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 2.36M, False: 1.94M]
  |  |  |  |  ------------------
  |  |  |  |  790|  4.30M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.30M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.30M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  2.36M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  2.36M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  2.36M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  2.36M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.36M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.36M|{ \
  |  |  |  |  |  |  140|  2.36M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.36M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.36M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.36M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.36M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.36M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 580k, False: 1.78M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   580k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   580k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   580k|{ \
  |  |  |  |  |  |  |  |   57|   580k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 132k, False: 448k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   132k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   132k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   132k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   448k|    } else { \
  |  |  |  |  |  |  |  |   62|   448k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   448k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   448k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   448k|    } \
  |  |  |  |  |  |  |  |   66|   580k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   580k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   580k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   580k|{ \
  |  |  |  |  |  |  |  |  128|   876k|    do { \
  |  |  |  |  |  |  |  |  129|   876k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 109k, False: 767k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   109k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   109k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   109k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   109k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   109k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   109k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   109k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   109k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 61.8k, False: 47.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  61.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 61.6k, False: 235]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  61.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  61.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  61.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  61.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    235|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    235|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    235|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    235|            } \
  |  |  |  |  |  |  |  |  |  |  118|  61.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  47.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  47.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  47.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  47.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   109k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   109k|        } \
  |  |  |  |  |  |  |  |  132|   876k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   876k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   876k|        ct--; \
  |  |  |  |  |  |  |  |  135|   876k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 295k, False: 580k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   580k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.78M|    } else {  \
  |  |  |  |  |  |  149|  1.78M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.78M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 561k, False: 1.22M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   561k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   561k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   561k|{ \
  |  |  |  |  |  |  |  |   45|   561k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 117k, False: 444k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   117k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   117k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   444k|    } else { \
  |  |  |  |  |  |  |  |   49|   444k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   444k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   444k|    } \
  |  |  |  |  |  |  |  |   52|   561k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   561k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   561k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   561k|{ \
  |  |  |  |  |  |  |  |  128|   608k|    do { \
  |  |  |  |  |  |  |  |  129|   608k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 75.8k, False: 532k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  75.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  75.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  75.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  75.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  75.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  75.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  75.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  75.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 43.0k, False: 32.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  43.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 42.9k, False: 136]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  42.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  42.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  42.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  42.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    136|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    136|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    136|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    136|            } \
  |  |  |  |  |  |  |  |  |  |  118|  43.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  32.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  32.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  32.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  32.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  75.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  75.8k|        } \
  |  |  |  |  |  |  |  |  132|   608k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   608k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   608k|        ct--; \
  |  |  |  |  |  |  |  |  135|   608k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 46.5k, False: 561k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   561k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.22M|        } else { \
  |  |  |  |  |  |  154|  1.22M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.22M|        } \
  |  |  |  |  |  |  156|  1.78M|    } \
  |  |  |  |  |  |  157|  2.36M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  2.36M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 1.17M, False: 1.18M]
  |  |  |  |  ------------------
  |  |  |  |  795|  2.36M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  2.36M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  2.36M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  2.36M|    } \
  |  |  |  |  797|  4.30M|}
  |  |  ------------------
  |  | 1001|  4.30M|                                flags, data, l_w, 1, \
  |  | 1002|  4.30M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1003|  4.30M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  4.30M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  4.30M|{ \
  |  |  |  |  789|  4.30M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.30M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.30M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  4.30M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  4.30M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 2.36M, False: 1.93M]
  |  |  |  |  ------------------
  |  |  |  |  790|  4.30M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.30M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.30M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  2.36M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  2.36M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  2.36M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  2.36M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.36M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.36M|{ \
  |  |  |  |  |  |  140|  2.36M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.36M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.36M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.36M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.36M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.36M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 584k, False: 1.78M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   584k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   584k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   584k|{ \
  |  |  |  |  |  |  |  |   57|   584k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 133k, False: 451k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   133k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   133k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   133k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   451k|    } else { \
  |  |  |  |  |  |  |  |   62|   451k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   451k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   451k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   451k|    } \
  |  |  |  |  |  |  |  |   66|   584k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   584k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   584k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   584k|{ \
  |  |  |  |  |  |  |  |  128|   883k|    do { \
  |  |  |  |  |  |  |  |  129|   883k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 110k, False: 772k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   110k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   110k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   110k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   110k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   110k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   110k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   110k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   110k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 62.4k, False: 47.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  62.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 62.2k, False: 199]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  62.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  62.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  62.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  62.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    199|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    199|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    199|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    199|            } \
  |  |  |  |  |  |  |  |  |  |  118|  62.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  47.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  47.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  47.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  47.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   110k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   110k|        } \
  |  |  |  |  |  |  |  |  132|   883k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   883k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   883k|        ct--; \
  |  |  |  |  |  |  |  |  135|   883k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 298k, False: 584k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   584k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.78M|    } else {  \
  |  |  |  |  |  |  149|  1.78M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.78M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 560k, False: 1.22M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   560k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   560k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   560k|{ \
  |  |  |  |  |  |  |  |   45|   560k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 117k, False: 443k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   117k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   117k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   443k|    } else { \
  |  |  |  |  |  |  |  |   49|   443k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   443k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   443k|    } \
  |  |  |  |  |  |  |  |   52|   560k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   560k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   560k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   560k|{ \
  |  |  |  |  |  |  |  |  128|   606k|    do { \
  |  |  |  |  |  |  |  |  129|   606k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 75.7k, False: 530k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  75.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  75.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  75.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  75.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  75.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  75.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  75.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  75.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 42.6k, False: 33.0k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  42.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 42.5k, False: 108]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  42.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  42.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  42.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  42.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    108|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    108|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    108|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    108|            } \
  |  |  |  |  |  |  |  |  |  |  118|  42.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  33.0k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  33.0k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  33.0k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  33.0k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  75.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  75.7k|        } \
  |  |  |  |  |  |  |  |  132|   606k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   606k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   606k|        ct--; \
  |  |  |  |  |  |  |  |  135|   606k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 45.9k, False: 560k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   560k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.22M|        } else { \
  |  |  |  |  |  |  154|  1.22M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.22M|        } \
  |  |  |  |  |  |  156|  1.78M|    } \
  |  |  |  |  |  |  157|  2.36M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  2.36M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 1.18M, False: 1.18M]
  |  |  |  |  ------------------
  |  |  |  |  795|  2.36M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  2.36M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  2.36M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  2.36M|    } \
  |  |  |  |  797|  4.30M|}
  |  |  ------------------
  |  | 1004|  4.30M|                                flags, data, l_w, 2, \
  |  | 1005|  4.30M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1006|  4.30M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  4.30M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  4.30M|{ \
  |  |  |  |  789|  4.30M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.30M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.30M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  4.30M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  4.30M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 2.38M, False: 1.91M]
  |  |  |  |  ------------------
  |  |  |  |  790|  4.30M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.30M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.30M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  2.38M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  2.38M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  2.38M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  2.38M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.38M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.38M|{ \
  |  |  |  |  |  |  140|  2.38M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.38M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.38M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.38M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.38M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.38M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 599k, False: 1.79M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   599k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   599k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   599k|{ \
  |  |  |  |  |  |  |  |   57|   599k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 134k, False: 464k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   134k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   134k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   134k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   464k|    } else { \
  |  |  |  |  |  |  |  |   62|   464k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   464k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   464k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   464k|    } \
  |  |  |  |  |  |  |  |   66|   599k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   599k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   599k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   599k|{ \
  |  |  |  |  |  |  |  |  128|   904k|    do { \
  |  |  |  |  |  |  |  |  129|   904k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 112k, False: 791k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   112k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   112k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   112k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   112k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   112k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   112k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   112k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   112k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 61.6k, False: 51.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  61.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 61.4k, False: 234]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  61.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  61.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  61.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  61.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    234|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    234|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    234|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    234|            } \
  |  |  |  |  |  |  |  |  |  |  118|  61.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  51.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  51.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  51.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  51.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   112k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   112k|        } \
  |  |  |  |  |  |  |  |  132|   904k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   904k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   904k|        ct--; \
  |  |  |  |  |  |  |  |  135|   904k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 305k, False: 599k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   599k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.79M|    } else {  \
  |  |  |  |  |  |  149|  1.79M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.79M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 575k, False: 1.21M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   575k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   575k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   575k|{ \
  |  |  |  |  |  |  |  |   45|   575k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 119k, False: 456k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   119k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   119k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   456k|    } else { \
  |  |  |  |  |  |  |  |   49|   456k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   456k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   456k|    } \
  |  |  |  |  |  |  |  |   52|   575k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   575k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   575k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   575k|{ \
  |  |  |  |  |  |  |  |  128|   623k|    do { \
  |  |  |  |  |  |  |  |  129|   623k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 78.3k, False: 544k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  78.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  78.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  78.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  78.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  78.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  78.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  78.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  78.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 42.8k, False: 35.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  42.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 42.6k, False: 172]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  42.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  42.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  42.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  42.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    172|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    172|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    172|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    172|            } \
  |  |  |  |  |  |  |  |  |  |  118|  42.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  35.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  35.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  35.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  35.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  78.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  78.3k|        } \
  |  |  |  |  |  |  |  |  132|   623k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   623k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   623k|        ct--; \
  |  |  |  |  |  |  |  |  135|   623k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 47.2k, False: 575k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   575k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.21M|        } else { \
  |  |  |  |  |  |  154|  1.21M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.21M|        } \
  |  |  |  |  |  |  156|  1.79M|    } \
  |  |  |  |  |  |  157|  2.38M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  2.38M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 1.19M, False: 1.19M]
  |  |  |  |  ------------------
  |  |  |  |  795|  2.38M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  2.38M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  2.38M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  2.38M|    } \
  |  |  |  |  797|  4.30M|}
  |  |  ------------------
  |  | 1007|  4.30M|                                flags, data, l_w, 3, \
  |  | 1008|  4.30M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1009|  4.30M|                            *flagsp = flags; \
  |  | 1010|  4.30M|                        } \
  |  | 1011|  7.72M|                } \
  |  | 1012|   120k|        } \
  |  | 1013|  7.54k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  7.54k|        mqc->curctx = curctx; \
  |  |  |  |  167|  7.54k|        mqc->c = c; \
  |  |  |  |  168|  7.54k|        mqc->a = a; \
  |  |  |  |  169|  7.54k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1014|  7.54k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1014:13): [True: 0, False: 7.54k]
  |  |  ------------------
  |  | 1015|      0|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1015:25): [True: 0, False: 0]
  |  |  ------------------
  |  | 1016|      0|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1016:29): [True: 0, False: 0]
  |  |  ------------------
  |  | 1017|      0|                        opj_t1_dec_refpass_step_mqc(t1, flagsp, data + j * l_w, poshalf, j); \
  |  | 1018|      0|                } \
  |  | 1019|      0|            } \
  |  | 1020|      0|        } \
  |  | 1021|  7.54k|}
  ------------------
 1028|  7.54k|}
t1.c:opj_t1_getctxno_mag:
  295|  17.6M|{
  296|  17.6M|    OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |  158|  17.6M|#define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  149|  17.6M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  17.6M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  150|  17.6M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  17.6M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  151|  17.6M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  17.6M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  152|  17.6M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  17.6M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  154|  17.6M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  17.6M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  155|  17.6M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|  17.6M|#define T1_SIGMA_6  (1U << 6)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  156|  17.6M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  17.6M|#define T1_SIGMA_7  (1U << 7)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
  |  |  ------------------
  |  |  |  |  157|  17.6M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  17.6M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |   63|  17.5M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|  17.5M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  17.5M|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  17.5M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|  17.5M|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
                  OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |   63|  17.6M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|  57.6k|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  57.6k|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  57.6k|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|  57.6k|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
  |  Branch (296:22): [True: 17.5M, False: 57.6k]
  ------------------
  297|  17.6M|    OPJ_UINT32 tmp2 = (f & T1_MU_0) ? T1_CTXNO_MAG + 2 : tmp;
  ------------------
  |  |  114|  17.6M|#define T1_MU_0     (1U << 20)
  ------------------
                  OPJ_UINT32 tmp2 = (f & T1_MU_0) ? T1_CTXNO_MAG + 2 : tmp;
  ------------------
  |  |   63|  12.8M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|  12.8M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  12.8M|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  12.8M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|  12.8M|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
  |  Branch (297:23): [True: 12.8M, False: 4.72M]
  ------------------
  298|  17.6M|    return tmp2;
  299|  17.6M|}
t1.c:opj_t1_dec_refpass_step_mqc:
  805|   621k|{
  806|   621k|    OPJ_UINT32 v;
  807|       |
  808|   621k|    opj_mqc_t *mqc = &(t1->mqc);       /* MQC component */
  809|   621k|    opj_t1_dec_refpass_step_mqc_macro(*flagsp, datap, 0, ci,
  ------------------
  |  |  787|   621k|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  788|   621k|{ \
  |  |  789|   621k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  ------------------
  |  |  |  |  153|   621k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|   621k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  ------------------
  |  |  |  |  163|   621k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|   621k|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (789:9): [True: 436k, False: 185k]
  |  |  ------------------
  |  |  790|   621k|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  ------------------
  |  |  |  |  153|   621k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|   621k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  791|   436k|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  792|   436k|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  ------------------
  |  |  |  |   65|   436k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  793|   436k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   436k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   436k|{ \
  |  |  |  |  140|   436k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   436k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   436k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   436k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   436k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   436k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 67.3k, False: 368k]
  |  |  |  |  ------------------
  |  |  |  |  146|  67.3k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  67.3k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  67.3k|{ \
  |  |  |  |  |  |   57|  67.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 13.1k, False: 54.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  13.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  13.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  13.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  54.2k|    } else { \
  |  |  |  |  |  |   62|  54.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  54.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  54.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  54.2k|    } \
  |  |  |  |  |  |   66|  67.3k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  67.3k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  67.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  67.3k|{ \
  |  |  |  |  |  |  128|   112k|    do { \
  |  |  |  |  |  |  129|   112k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 13.9k, False: 98.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  13.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  13.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  13.9k|{ \
  |  |  |  |  |  |  |  |  104|  13.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  13.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  13.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  13.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  13.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.7k, False: 279]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  13.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.6k, False: 82]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  13.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  13.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  13.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  13.6k|            } else { \
  |  |  |  |  |  |  |  |  114|     82|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     82|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     82|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     82|            } \
  |  |  |  |  |  |  |  |  118|  13.7k|        } else { \
  |  |  |  |  |  |  |  |  119|    279|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    279|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    279|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    279|        } \
  |  |  |  |  |  |  |  |  123|  13.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  13.9k|        } \
  |  |  |  |  |  |  132|   112k|        a <<= 1; \
  |  |  |  |  |  |  133|   112k|        c <<= 1; \
  |  |  |  |  |  |  134|   112k|        ct--; \
  |  |  |  |  |  |  135|   112k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 44.8k, False: 67.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  67.3k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   368k|    } else {  \
  |  |  |  |  149|   368k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   368k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 73.1k, False: 295k]
  |  |  |  |  ------------------
  |  |  |  |  151|  73.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  73.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  73.1k|{ \
  |  |  |  |  |  |   45|  73.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 11.1k, False: 62.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  11.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  11.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  62.0k|    } else { \
  |  |  |  |  |  |   49|  62.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  62.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  62.0k|    } \
  |  |  |  |  |  |   52|  73.1k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  73.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  73.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  73.1k|{ \
  |  |  |  |  |  |  128|  77.3k|    do { \
  |  |  |  |  |  |  129|  77.3k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 9.72k, False: 67.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  9.72k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  9.72k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  9.72k|{ \
  |  |  |  |  |  |  |  |  104|  9.72k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  9.72k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  9.72k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  9.72k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  9.72k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.51k, False: 213]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  9.51k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.44k, False: 70]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  9.44k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  9.44k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  9.44k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  9.44k|            } else { \
  |  |  |  |  |  |  |  |  114|     70|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     70|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     70|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     70|            } \
  |  |  |  |  |  |  |  |  118|  9.51k|        } else { \
  |  |  |  |  |  |  |  |  119|    213|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    213|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    213|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    213|        } \
  |  |  |  |  |  |  |  |  123|  9.72k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  9.72k|        } \
  |  |  |  |  |  |  132|  77.3k|        a <<= 1; \
  |  |  |  |  |  |  133|  77.3k|        c <<= 1; \
  |  |  |  |  |  |  134|  77.3k|        ct--; \
  |  |  |  |  |  |  135|  77.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 4.19k, False: 73.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  73.1k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   295k|        } else { \
  |  |  |  |  154|   295k|            d = (*curctx)->mps; \
  |  |  |  |  155|   295k|        } \
  |  |  |  |  156|   368k|    } \
  |  |  |  |  157|   436k|}
  |  |  ------------------
  |  |  794|   436k|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  ------------------
  |  |  |  Branch (794:33): [True: 210k, False: 225k]
  |  |  ------------------
  |  |  795|   436k|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  ------------------
  |  |  |  |  162|   436k|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|   436k|#define T1_MU_0     (1U << 20)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  796|   436k|    } \
  |  |  797|   621k|}
  ------------------
  810|   621k|                                      mqc, mqc->curctx, v, mqc->a, mqc->c,
  811|   621k|                                      mqc->ct, poshalf);
  812|   621k|}
t1.c:opj_t1_dec_refpass_mqc_generic:
 1033|  18.1k|{
 1034|  18.1k|    opj_t1_dec_refpass_mqc_internal(t1, bpno, t1->w, t1->h, t1->w + 2U);
  ------------------
  |  |  981|  18.1k|#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) \
  |  |  982|  18.1k|{ \
  |  |  983|  18.1k|        OPJ_INT32 one, poshalf; \
  |  |  984|  18.1k|        OPJ_UINT32 i, j, k; \
  |  |  985|  18.1k|        register OPJ_INT32 *data = t1->data; \
  |  |  986|  18.1k|        register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  |  987|  18.1k|        const OPJ_UINT32 l_w = w; \
  |  |  988|  18.1k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  989|  18.1k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  18.1k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  18.1k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  18.1k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  18.1k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  990|  18.1k|        register OPJ_UINT32 v; \
  |  |  991|  18.1k|        one = 1 << bpno; \
  |  |  992|  18.1k|        poshalf = one >> 1; \
  |  |  993|   131k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (993:21): [True: 113k, False: 18.1k]
  |  |  ------------------
  |  |  994|  4.24M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (994:29): [True: 4.12M, False: 113k]
  |  |  ------------------
  |  |  995|  4.12M|                        opj_flag_t flags = *flagsp; \
  |  |  996|  4.12M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (996:29): [True: 3.15M, False: 974k]
  |  |  ------------------
  |  |  997|  3.15M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  3.15M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  3.15M|{ \
  |  |  |  |  789|  3.15M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.15M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  3.15M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  3.15M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 1.88M, False: 1.26M]
  |  |  |  |  ------------------
  |  |  |  |  790|  3.15M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.15M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  1.88M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  1.88M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.88M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  1.88M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.88M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.88M|{ \
  |  |  |  |  |  |  140|  1.88M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.88M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.88M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.88M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.88M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.88M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 533k, False: 1.35M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   533k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   533k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   533k|{ \
  |  |  |  |  |  |  |  |   57|   533k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 126k, False: 407k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   126k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   126k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   126k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   407k|    } else { \
  |  |  |  |  |  |  |  |   62|   407k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   407k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   407k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   407k|    } \
  |  |  |  |  |  |  |  |   66|   533k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   533k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   533k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   533k|{ \
  |  |  |  |  |  |  |  |  128|   790k|    do { \
  |  |  |  |  |  |  |  |  129|   790k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 98.5k, False: 692k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  98.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  98.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  98.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  98.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  98.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  98.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  98.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  98.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 56.8k, False: 41.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  56.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 56.6k, False: 254]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  56.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  56.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  56.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  56.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    254|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    254|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    254|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    254|            } \
  |  |  |  |  |  |  |  |  |  |  118|  56.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  41.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  41.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  41.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  41.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  98.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  98.5k|        } \
  |  |  |  |  |  |  |  |  132|   790k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   790k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   790k|        ct--; \
  |  |  |  |  |  |  |  |  135|   790k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 256k, False: 533k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   533k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.35M|    } else {  \
  |  |  |  |  |  |  149|  1.35M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.35M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 508k, False: 843k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   508k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   508k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   508k|{ \
  |  |  |  |  |  |  |  |   45|   508k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 115k, False: 393k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   115k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   115k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   393k|    } else { \
  |  |  |  |  |  |  |  |   49|   393k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   393k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   393k|    } \
  |  |  |  |  |  |  |  |   52|   508k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   508k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   508k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   508k|{ \
  |  |  |  |  |  |  |  |  128|   551k|    do { \
  |  |  |  |  |  |  |  |  129|   551k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 68.0k, False: 483k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  68.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  68.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  68.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  68.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  68.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  68.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  68.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  68.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 38.9k, False: 29.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  38.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 38.7k, False: 174]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  38.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  38.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  38.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  38.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    174|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    174|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    174|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    174|            } \
  |  |  |  |  |  |  |  |  |  |  118|  38.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  29.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  29.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  29.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  29.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  68.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  68.0k|        } \
  |  |  |  |  |  |  |  |  132|   551k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   551k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   551k|        ct--; \
  |  |  |  |  |  |  |  |  135|   551k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 43.5k, False: 508k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   508k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   843k|        } else { \
  |  |  |  |  |  |  154|   843k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   843k|        } \
  |  |  |  |  |  |  156|  1.35M|    } \
  |  |  |  |  |  |  157|  1.88M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  1.88M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 940k, False: 944k]
  |  |  |  |  ------------------
  |  |  |  |  795|  1.88M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  1.88M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  1.88M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  1.88M|    } \
  |  |  |  |  797|  3.15M|}
  |  |  ------------------
  |  |  998|  3.15M|                                flags, data, l_w, 0, \
  |  |  999|  3.15M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1000|  3.15M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  3.15M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  3.15M|{ \
  |  |  |  |  789|  3.15M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.15M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  3.15M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  3.15M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 1.90M, False: 1.24M]
  |  |  |  |  ------------------
  |  |  |  |  790|  3.15M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.15M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  1.90M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  1.90M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.90M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  1.90M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.90M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.90M|{ \
  |  |  |  |  |  |  140|  1.90M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.90M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.90M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.90M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.90M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.90M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 538k, False: 1.36M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   538k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   538k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   538k|{ \
  |  |  |  |  |  |  |  |   57|   538k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 128k, False: 409k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   128k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   128k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   128k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   409k|    } else { \
  |  |  |  |  |  |  |  |   62|   409k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   409k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   409k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   409k|    } \
  |  |  |  |  |  |  |  |   66|   538k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   538k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   538k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   538k|{ \
  |  |  |  |  |  |  |  |  128|   797k|    do { \
  |  |  |  |  |  |  |  |  129|   797k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 100k, False: 696k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   100k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   100k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   100k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   100k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   100k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   100k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   100k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   100k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 58.5k, False: 42.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  58.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 58.3k, False: 202]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  58.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  58.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  58.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  58.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    202|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    202|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    202|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    202|            } \
  |  |  |  |  |  |  |  |  |  |  118|  58.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  42.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  42.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  42.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  42.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   100k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   100k|        } \
  |  |  |  |  |  |  |  |  132|   797k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   797k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   797k|        ct--; \
  |  |  |  |  |  |  |  |  135|   797k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 259k, False: 538k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   538k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.36M|    } else {  \
  |  |  |  |  |  |  149|  1.36M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.36M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 511k, False: 855k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   511k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   511k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   511k|{ \
  |  |  |  |  |  |  |  |   45|   511k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 117k, False: 393k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   117k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   117k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   393k|    } else { \
  |  |  |  |  |  |  |  |   49|   393k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   393k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   393k|    } \
  |  |  |  |  |  |  |  |   52|   511k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   511k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   511k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   511k|{ \
  |  |  |  |  |  |  |  |  128|   555k|    do { \
  |  |  |  |  |  |  |  |  129|   555k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 69.9k, False: 485k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  69.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  69.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  69.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  69.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  69.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  69.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  69.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  69.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 39.5k, False: 30.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  39.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 39.4k, False: 157]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  39.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  39.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  39.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  39.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    157|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    157|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    157|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    157|            } \
  |  |  |  |  |  |  |  |  |  |  118|  39.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  30.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  30.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  30.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  30.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  69.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  69.9k|        } \
  |  |  |  |  |  |  |  |  132|   555k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   555k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   555k|        ct--; \
  |  |  |  |  |  |  |  |  135|   555k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 44.5k, False: 511k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   511k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   855k|        } else { \
  |  |  |  |  |  |  154|   855k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   855k|        } \
  |  |  |  |  |  |  156|  1.36M|    } \
  |  |  |  |  |  |  157|  1.90M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  1.90M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 949k, False: 954k]
  |  |  |  |  ------------------
  |  |  |  |  795|  1.90M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  1.90M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  1.90M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  1.90M|    } \
  |  |  |  |  797|  3.15M|}
  |  |  ------------------
  |  | 1001|  3.15M|                                flags, data, l_w, 1, \
  |  | 1002|  3.15M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1003|  3.15M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  3.15M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  3.15M|{ \
  |  |  |  |  789|  3.15M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.15M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  3.15M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  3.15M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 1.93M, False: 1.21M]
  |  |  |  |  ------------------
  |  |  |  |  790|  3.15M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.15M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  1.93M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  1.93M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.93M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  1.93M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.93M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.93M|{ \
  |  |  |  |  |  |  140|  1.93M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.93M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.93M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.93M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.93M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.93M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 545k, False: 1.38M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   545k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   545k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   545k|{ \
  |  |  |  |  |  |  |  |   57|   545k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 129k, False: 415k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   129k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   129k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   129k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   415k|    } else { \
  |  |  |  |  |  |  |  |   62|   415k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   415k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   415k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   415k|    } \
  |  |  |  |  |  |  |  |   66|   545k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   545k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   545k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   545k|{ \
  |  |  |  |  |  |  |  |  128|   811k|    do { \
  |  |  |  |  |  |  |  |  129|   811k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 101k, False: 710k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   101k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   101k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   101k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   101k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   101k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   101k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   101k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   101k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 58.3k, False: 42.7k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  58.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 58.0k, False: 211]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  58.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  58.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  58.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  58.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    211|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    211|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    211|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    211|            } \
  |  |  |  |  |  |  |  |  |  |  118|  58.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  42.7k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  42.7k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  42.7k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  42.7k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   101k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   101k|        } \
  |  |  |  |  |  |  |  |  132|   811k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   811k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   811k|        ct--; \
  |  |  |  |  |  |  |  |  135|   811k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 265k, False: 545k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   545k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.38M|    } else {  \
  |  |  |  |  |  |  149|  1.38M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.38M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 521k, False: 867k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   521k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   521k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   521k|{ \
  |  |  |  |  |  |  |  |   45|   521k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 119k, False: 402k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   119k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   119k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   402k|    } else { \
  |  |  |  |  |  |  |  |   49|   402k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   402k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   402k|    } \
  |  |  |  |  |  |  |  |   52|   521k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   521k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   521k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   521k|{ \
  |  |  |  |  |  |  |  |  128|   566k|    do { \
  |  |  |  |  |  |  |  |  129|   566k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 70.7k, False: 496k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  70.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  70.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  70.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  70.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  70.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  70.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  70.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  70.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 40.7k, False: 29.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  40.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 40.6k, False: 171]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  40.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  40.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  40.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  40.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    171|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    171|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    171|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    171|            } \
  |  |  |  |  |  |  |  |  |  |  118|  40.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  29.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  29.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  29.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  29.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  70.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  70.7k|        } \
  |  |  |  |  |  |  |  |  132|   566k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   566k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   566k|        ct--; \
  |  |  |  |  |  |  |  |  135|   566k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 45.1k, False: 521k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   521k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   867k|        } else { \
  |  |  |  |  |  |  154|   867k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   867k|        } \
  |  |  |  |  |  |  156|  1.38M|    } \
  |  |  |  |  |  |  157|  1.93M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  1.93M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 966k, False: 969k]
  |  |  |  |  ------------------
  |  |  |  |  795|  1.93M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  1.93M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  1.93M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  1.93M|    } \
  |  |  |  |  797|  3.15M|}
  |  |  ------------------
  |  | 1004|  3.15M|                                flags, data, l_w, 2, \
  |  | 1005|  3.15M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1006|  3.15M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  3.15M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  3.15M|{ \
  |  |  |  |  789|  3.15M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.15M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  3.15M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  3.15M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 1.94M, False: 1.21M]
  |  |  |  |  ------------------
  |  |  |  |  790|  3.15M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.15M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  1.94M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  1.94M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.94M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  1.94M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.94M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.94M|{ \
  |  |  |  |  |  |  140|  1.94M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.94M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.94M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.94M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.94M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.94M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 550k, False: 1.39M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   550k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   550k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   550k|{ \
  |  |  |  |  |  |  |  |   57|   550k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 131k, False: 419k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   131k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   131k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   131k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   419k|    } else { \
  |  |  |  |  |  |  |  |   62|   419k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   419k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   419k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   419k|    } \
  |  |  |  |  |  |  |  |   66|   550k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   550k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   550k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   550k|{ \
  |  |  |  |  |  |  |  |  128|   817k|    do { \
  |  |  |  |  |  |  |  |  129|   817k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 102k, False: 714k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   102k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   102k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   102k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   102k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   102k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   102k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   102k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   102k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 57.9k, False: 44.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  57.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 57.7k, False: 196]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  57.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  57.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  57.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  57.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    196|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    196|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    196|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    196|            } \
  |  |  |  |  |  |  |  |  |  |  118|  57.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  44.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  44.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  44.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  44.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   102k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   102k|        } \
  |  |  |  |  |  |  |  |  132|   817k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   817k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   817k|        ct--; \
  |  |  |  |  |  |  |  |  135|   817k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 266k, False: 550k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   550k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.39M|    } else {  \
  |  |  |  |  |  |  149|  1.39M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.39M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 524k, False: 866k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   524k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   524k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   524k|{ \
  |  |  |  |  |  |  |  |   45|   524k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 119k, False: 405k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   119k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   119k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   405k|    } else { \
  |  |  |  |  |  |  |  |   49|   405k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   405k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   405k|    } \
  |  |  |  |  |  |  |  |   52|   524k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   524k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   524k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   524k|{ \
  |  |  |  |  |  |  |  |  128|   569k|    do { \
  |  |  |  |  |  |  |  |  129|   569k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 71.4k, False: 498k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  71.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  71.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  71.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  71.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  71.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  71.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  71.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  71.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 40.8k, False: 30.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  40.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 40.6k, False: 159]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  40.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  40.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  40.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  40.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    159|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    159|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    159|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    159|            } \
  |  |  |  |  |  |  |  |  |  |  118|  40.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  30.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  30.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  30.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  30.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  71.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  71.4k|        } \
  |  |  |  |  |  |  |  |  132|   569k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   569k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   569k|        ct--; \
  |  |  |  |  |  |  |  |  135|   569k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 44.6k, False: 524k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   524k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   866k|        } else { \
  |  |  |  |  |  |  154|   866k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   866k|        } \
  |  |  |  |  |  |  156|  1.39M|    } \
  |  |  |  |  |  |  157|  1.94M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  1.94M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 968k, False: 974k]
  |  |  |  |  ------------------
  |  |  |  |  795|  1.94M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  1.94M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  1.94M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  1.94M|    } \
  |  |  |  |  797|  3.15M|}
  |  |  ------------------
  |  | 1007|  3.15M|                                flags, data, l_w, 3, \
  |  | 1008|  3.15M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1009|  3.15M|                            *flagsp = flags; \
  |  | 1010|  3.15M|                        } \
  |  | 1011|  4.12M|                } \
  |  | 1012|   113k|        } \
  |  | 1013|  18.1k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  18.1k|        mqc->curctx = curctx; \
  |  |  |  |  167|  18.1k|        mqc->c = c; \
  |  |  |  |  168|  18.1k|        mqc->a = a; \
  |  |  |  |  169|  18.1k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1014|  18.1k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1014:13): [True: 2.29k, False: 15.8k]
  |  |  ------------------
  |  | 1015|   295k|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1015:25): [True: 292k, False: 2.29k]
  |  |  ------------------
  |  | 1016|   914k|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1016:29): [True: 621k, False: 292k]
  |  |  ------------------
  |  | 1017|   621k|                        opj_t1_dec_refpass_step_mqc(t1, flagsp, data + j * l_w, poshalf, j); \
  |  | 1018|   621k|                } \
  |  | 1019|   292k|            } \
  |  | 1020|  2.29k|        } \
  |  | 1021|  18.1k|}
  ------------------
 1035|  18.1k|}
t1.c:opj_t1_dec_clnpass:
 1398|  37.0k|{
 1399|  37.0k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (1399:9): [True: 10.1k, False: 26.8k]
  |  Branch (1399:24): [True: 8.85k, False: 1.31k]
  ------------------
 1400|  8.85k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|  8.85k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (1400:13): [True: 2.47k, False: 6.38k]
  ------------------
 1401|  2.47k|            opj_t1_dec_clnpass_64x64_vsc(t1, bpno);
 1402|  6.38k|        } else {
 1403|  6.38k|            opj_t1_dec_clnpass_64x64_novsc(t1, bpno);
 1404|  6.38k|        }
 1405|  28.1k|    } else {
 1406|  28.1k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|  28.1k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (1406:13): [True: 10.3k, False: 17.8k]
  ------------------
 1407|  10.3k|            opj_t1_dec_clnpass_generic_vsc(t1, bpno);
 1408|  17.8k|        } else {
 1409|  17.8k|            opj_t1_dec_clnpass_generic_novsc(t1, bpno);
 1410|  17.8k|        }
 1411|  28.1k|    }
 1412|  37.0k|    opj_t1_dec_clnpass_check_segsym(t1, cblksty);
 1413|  37.0k|}
t1.c:opj_t1_dec_clnpass_64x64_vsc:
 1374|  2.47k|{
 1375|  2.47k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_TRUE, 64, 64, 66);
  ------------------
  |  | 1254|  2.47k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1255|  2.47k|{ \
  |  | 1256|  2.47k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1257|  2.47k|    OPJ_UINT32 runlen; \
  |  | 1258|  2.47k|    OPJ_UINT32 i, j, k; \
  |  | 1259|  2.47k|    const OPJ_UINT32 l_w = w; \
  |  | 1260|  2.47k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1261|  2.47k|    register OPJ_INT32 *data = t1->data; \
  |  | 1262|  2.47k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1263|  2.47k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  2.47k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  2.47k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  2.47k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  2.47k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1264|  2.47k|    register OPJ_UINT32 v; \
  |  | 1265|  2.47k|    one = 1 << bpno; \
  |  | 1266|  2.47k|    half = one >> 1; \
  |  | 1267|  2.47k|    oneplushalf = one | half; \
  |  | 1268|  42.0k|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 39.5k, False: 2.47k]
  |  |  ------------------
  |  | 1269|  2.57M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1269:21): [True: 2.53M, False: 39.5k]
  |  |  ------------------
  |  | 1270|  2.53M|            opj_flag_t flags = *flagsp; \
  |  | 1271|  2.53M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1271:17): [True: 496k, False: 2.03M]
  |  |  ------------------
  |  | 1272|   496k|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|   496k|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1273|   496k|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   65|   496k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1274|   496k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   496k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   496k|{ \
  |  |  |  |  140|   496k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   496k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   496k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   496k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   496k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   496k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 25.0k, False: 471k]
  |  |  |  |  ------------------
  |  |  |  |  146|  25.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  25.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  25.0k|{ \
  |  |  |  |  |  |   57|  25.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 1.79k, False: 23.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  1.79k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  1.79k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  1.79k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  23.2k|    } else { \
  |  |  |  |  |  |   62|  23.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  23.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  23.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  23.2k|    } \
  |  |  |  |  |  |   66|  25.0k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  25.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  25.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  25.0k|{ \
  |  |  |  |  |  |  128|  70.1k|    do { \
  |  |  |  |  |  |  129|  70.1k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 8.64k, False: 61.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  8.64k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  8.64k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  8.64k|{ \
  |  |  |  |  |  |  |  |  104|  8.64k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  8.64k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  8.64k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  8.64k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  8.64k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.72k, False: 1.92k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  6.72k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.49k, False: 235]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  6.49k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  6.49k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  6.49k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  6.49k|            } else { \
  |  |  |  |  |  |  |  |  114|    235|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    235|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    235|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    235|            } \
  |  |  |  |  |  |  |  |  118|  6.72k|        } else { \
  |  |  |  |  |  |  |  |  119|  1.92k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  1.92k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  1.92k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  1.92k|        } \
  |  |  |  |  |  |  |  |  123|  8.64k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  8.64k|        } \
  |  |  |  |  |  |  132|  70.1k|        a <<= 1; \
  |  |  |  |  |  |  133|  70.1k|        c <<= 1; \
  |  |  |  |  |  |  134|  70.1k|        ct--; \
  |  |  |  |  |  |  135|  70.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 45.1k, False: 25.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  25.0k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   471k|    } else {  \
  |  |  |  |  149|   471k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   471k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 33.3k, False: 437k]
  |  |  |  |  ------------------
  |  |  |  |  151|  33.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  33.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  33.3k|{ \
  |  |  |  |  |  |   45|  33.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 1.46k, False: 31.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  1.46k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  1.46k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  31.8k|    } else { \
  |  |  |  |  |  |   49|  31.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  31.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  31.8k|    } \
  |  |  |  |  |  |   52|  33.3k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  33.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  33.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  33.3k|{ \
  |  |  |  |  |  |  128|  33.9k|    do { \
  |  |  |  |  |  |  129|  33.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 5.20k, False: 28.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  5.20k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  5.20k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  5.20k|{ \
  |  |  |  |  |  |  |  |  104|  5.20k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  5.20k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  5.20k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  5.20k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  5.20k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.96k, False: 1.24k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  3.96k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.84k, False: 128]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  3.84k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  3.84k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  3.84k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  3.84k|            } else { \
  |  |  |  |  |  |  |  |  114|    128|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    128|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    128|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    128|            } \
  |  |  |  |  |  |  |  |  118|  3.96k|        } else { \
  |  |  |  |  |  |  |  |  119|  1.24k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  1.24k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  1.24k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  1.24k|        } \
  |  |  |  |  |  |  |  |  123|  5.20k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  5.20k|        } \
  |  |  |  |  |  |  132|  33.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  33.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  33.9k|        ct--; \
  |  |  |  |  |  |  135|  33.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 647, False: 33.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  33.3k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   437k|        } else { \
  |  |  |  |  154|   437k|            d = (*curctx)->mps; \
  |  |  |  |  155|   437k|        } \
  |  |  |  |  156|   471k|    } \
  |  |  |  |  157|   496k|}
  |  |  ------------------
  |  | 1275|   496k|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1275:21): [True: 468k, False: 27.3k]
  |  |  ------------------
  |  | 1276|   468k|                    continue; \
  |  | 1277|   468k|                } \
  |  | 1278|   496k|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   65|  27.3k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1279|  27.3k|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  27.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  27.3k|{ \
  |  |  |  |  140|  27.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  27.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  27.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  27.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  27.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  27.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 12.9k, False: 14.4k]
  |  |  |  |  ------------------
  |  |  |  |  146|  12.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  12.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  12.9k|{ \
  |  |  |  |  |  |   57|  12.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 7.67k, False: 5.27k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  7.67k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  7.67k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  7.67k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  7.67k|    } else { \
  |  |  |  |  |  |   62|  5.27k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  5.27k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  5.27k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  5.27k|    } \
  |  |  |  |  |  |   66|  12.9k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  12.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  12.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  12.9k|{ \
  |  |  |  |  |  |  128|  12.9k|    do { \
  |  |  |  |  |  |  129|  12.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.53k, False: 11.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.53k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.53k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.53k|{ \
  |  |  |  |  |  |  |  |  104|  1.53k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.53k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.53k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.53k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.53k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.19k, False: 336]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  1.19k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.13k, False: 62]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.13k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.13k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.13k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.13k|            } else { \
  |  |  |  |  |  |  |  |  114|     62|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     62|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     62|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     62|            } \
  |  |  |  |  |  |  |  |  118|  1.19k|        } else { \
  |  |  |  |  |  |  |  |  119|    336|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    336|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    336|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    336|        } \
  |  |  |  |  |  |  |  |  123|  1.53k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.53k|        } \
  |  |  |  |  |  |  132|  12.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  12.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  12.9k|        ct--; \
  |  |  |  |  |  |  135|  12.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 12.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  12.9k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  14.4k|    } else {  \
  |  |  |  |  149|  14.4k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  14.4k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 11.8k, False: 2.58k]
  |  |  |  |  ------------------
  |  |  |  |  151|  11.8k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  11.8k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  11.8k|{ \
  |  |  |  |  |  |   45|  11.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 7.09k, False: 4.75k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  7.09k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  7.09k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  7.09k|    } else { \
  |  |  |  |  |  |   49|  4.75k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  4.75k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  4.75k|    } \
  |  |  |  |  |  |   52|  11.8k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  11.8k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  11.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  11.8k|{ \
  |  |  |  |  |  |  128|  14.6k|    do { \
  |  |  |  |  |  |  129|  14.6k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.69k, False: 12.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.69k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.69k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.69k|{ \
  |  |  |  |  |  |  |  |  104|  1.69k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.69k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.69k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.69k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.69k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.38k, False: 313]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  1.38k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.32k, False: 57]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.32k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.32k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.32k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.32k|            } else { \
  |  |  |  |  |  |  |  |  114|     57|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     57|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     57|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     57|            } \
  |  |  |  |  |  |  |  |  118|  1.38k|        } else { \
  |  |  |  |  |  |  |  |  119|    313|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    313|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    313|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    313|        } \
  |  |  |  |  |  |  |  |  123|  1.69k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.69k|        } \
  |  |  |  |  |  |  132|  14.6k|        a <<= 1; \
  |  |  |  |  |  |  133|  14.6k|        c <<= 1; \
  |  |  |  |  |  |  134|  14.6k|        ct--; \
  |  |  |  |  |  |  135|  14.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 2.82k, False: 11.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  11.8k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  11.8k|        } else { \
  |  |  |  |  154|  2.58k|            d = (*curctx)->mps; \
  |  |  |  |  155|  2.58k|        } \
  |  |  |  |  156|  14.4k|    } \
  |  |  |  |  157|  27.3k|}
  |  |  ------------------
  |  | 1280|  27.3k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  27.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  27.3k|{ \
  |  |  |  |  140|  27.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  27.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  27.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  27.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  27.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  27.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 12.5k, False: 14.8k]
  |  |  |  |  ------------------
  |  |  |  |  146|  12.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  12.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  12.5k|{ \
  |  |  |  |  |  |   57|  12.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 4.53k, False: 8.03k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  4.53k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  4.53k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  4.53k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  8.03k|    } else { \
  |  |  |  |  |  |   62|  8.03k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  8.03k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  8.03k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  8.03k|    } \
  |  |  |  |  |  |   66|  12.5k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  12.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  12.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  12.5k|{ \
  |  |  |  |  |  |  128|  12.5k|    do { \
  |  |  |  |  |  |  129|  12.5k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.42k, False: 11.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.42k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.42k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.42k|{ \
  |  |  |  |  |  |  |  |  104|  1.42k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.42k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.42k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.42k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.42k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.11k, False: 308]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  1.11k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.06k, False: 55]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.06k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.06k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.06k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.06k|            } else { \
  |  |  |  |  |  |  |  |  114|     55|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     55|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     55|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     55|            } \
  |  |  |  |  |  |  |  |  118|  1.11k|        } else { \
  |  |  |  |  |  |  |  |  119|    308|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    308|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    308|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    308|        } \
  |  |  |  |  |  |  |  |  123|  1.42k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.42k|        } \
  |  |  |  |  |  |  132|  12.5k|        a <<= 1; \
  |  |  |  |  |  |  133|  12.5k|        c <<= 1; \
  |  |  |  |  |  |  134|  12.5k|        ct--; \
  |  |  |  |  |  |  135|  12.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 12.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  12.5k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  14.8k|    } else {  \
  |  |  |  |  149|  14.8k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  14.8k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 12.8k, False: 1.99k]
  |  |  |  |  ------------------
  |  |  |  |  151|  12.8k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  12.8k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  12.8k|{ \
  |  |  |  |  |  |   45|  12.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 2.34k, False: 10.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  2.34k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  2.34k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  10.4k|    } else { \
  |  |  |  |  |  |   49|  10.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  10.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  10.4k|    } \
  |  |  |  |  |  |   52|  12.8k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  12.8k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  12.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  12.8k|{ \
  |  |  |  |  |  |  128|  14.2k|    do { \
  |  |  |  |  |  |  129|  14.2k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.14k, False: 13.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.14k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.14k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.14k|{ \
  |  |  |  |  |  |  |  |  104|  1.14k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.14k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.14k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.14k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.14k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 845, False: 298]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    845|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 786, False: 59]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    786|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    786|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    786|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    786|            } else { \
  |  |  |  |  |  |  |  |  114|     59|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     59|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     59|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     59|            } \
  |  |  |  |  |  |  |  |  118|    845|        } else { \
  |  |  |  |  |  |  |  |  119|    298|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    298|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    298|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    298|        } \
  |  |  |  |  |  |  |  |  123|  1.14k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.14k|        } \
  |  |  |  |  |  |  132|  14.2k|        a <<= 1; \
  |  |  |  |  |  |  133|  14.2k|        c <<= 1; \
  |  |  |  |  |  |  134|  14.2k|        ct--; \
  |  |  |  |  |  |  135|  14.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 1.38k, False: 12.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  12.8k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  12.8k|        } else { \
  |  |  |  |  154|  1.99k|            d = (*curctx)->mps; \
  |  |  |  |  155|  1.99k|        } \
  |  |  |  |  156|  14.8k|    } \
  |  |  |  |  157|  27.3k|}
  |  |  ------------------
  |  | 1281|  27.3k|                runlen = (runlen << 1) | v; \
  |  | 1282|  27.3k|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1282:24): [True: 0, False: 27.3k]
  |  |  ------------------
  |  | 1283|  9.39k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1283:21): [True: 9.39k, False: 17.9k]
  |  |  ------------------
  |  | 1284|  9.39k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1121|  9.39k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  9.39k|{ \
  |  |  |  | 1123|  9.39k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  9.39k|        do { \
  |  |  |  | 1125|  9.39k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|      0|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|      0|{ \
  |  |  |  |  |  |  140|      0|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|      0|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|      0|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|      0|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|      0|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|      0|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|      0|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|      0|{ \
  |  |  |  |  |  |  |  |   57|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|      0|    } else { \
  |  |  |  |  |  |  |  |   62|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|      0|    } \
  |  |  |  |  |  |  |  |   66|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|      0|    } else {  \
  |  |  |  |  |  |  149|      0|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|      0|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|      0|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|      0|{ \
  |  |  |  |  |  |  |  |   45|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|      0|    } else { \
  |  |  |  |  |  |  |  |   49|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|      0|    } \
  |  |  |  |  |  |  |  |   52|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|        } else { \
  |  |  |  |  |  |  154|      0|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      0|        } \
  |  |  |  |  |  |  156|      0|    } \
  |  |  |  |  |  |  157|      0|}
  |  |  |  |  ------------------
  |  |  |  | 1129|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1130|      0|                    break; \
  |  |  |  | 1131|      0|            } \
  |  |  |  | 1132|  9.39k|            { \
  |  |  |  | 1133|  9.39k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  9.39k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  9.39k|                                    ci); \
  |  |  |  | 1136|  9.39k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  9.39k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  9.39k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  9.39k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  9.39k|{ \
  |  |  |  |  |  |  140|  9.39k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  9.39k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  9.39k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  9.39k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  9.39k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  9.39k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.32k, False: 7.07k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.32k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.32k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.32k|{ \
  |  |  |  |  |  |  |  |   57|  2.32k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 97, False: 2.22k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     97|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     97|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     97|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  2.22k|    } else { \
  |  |  |  |  |  |  |  |   62|  2.22k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  2.22k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  2.22k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  2.22k|    } \
  |  |  |  |  |  |  |  |   66|  2.32k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.32k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.32k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.32k|{ \
  |  |  |  |  |  |  |  |  128|  3.64k|    do { \
  |  |  |  |  |  |  |  |  129|  3.64k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 360, False: 3.28k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    360|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    360|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    360|{ \
  |  |  |  |  |  |  |  |  |  |  104|    360|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    360|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    360|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    360|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    360|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 277, False: 83]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    277|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 256, False: 21]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    256|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    256|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    256|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    256|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     21|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     21|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     21|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     21|            } \
  |  |  |  |  |  |  |  |  |  |  118|    277|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     83|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     83|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     83|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     83|        } \
  |  |  |  |  |  |  |  |  |  |  123|    360|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    360|        } \
  |  |  |  |  |  |  |  |  132|  3.64k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.64k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.64k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.64k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.32k, False: 2.32k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.32k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  7.07k|    } else {  \
  |  |  |  |  |  |  149|  7.07k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  7.07k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.98k, False: 4.09k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.98k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.98k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.98k|{ \
  |  |  |  |  |  |  |  |   45|  2.98k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 72, False: 2.90k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     72|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     72|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.90k|    } else { \
  |  |  |  |  |  |  |  |   49|  2.90k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.90k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.90k|    } \
  |  |  |  |  |  |  |  |   52|  2.98k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.98k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.98k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.98k|{ \
  |  |  |  |  |  |  |  |  128|  2.98k|    do { \
  |  |  |  |  |  |  |  |  129|  2.98k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 756, False: 2.23k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    756|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    756|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    756|{ \
  |  |  |  |  |  |  |  |  |  |  104|    756|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    756|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    756|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    756|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    756|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 693, False: 63]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    693|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 683, False: 10]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    683|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    683|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    683|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    683|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     10|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     10|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     10|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     10|            } \
  |  |  |  |  |  |  |  |  |  |  118|    693|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     63|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     63|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     63|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     63|        } \
  |  |  |  |  |  |  |  |  |  |  123|    756|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    756|        } \
  |  |  |  |  |  |  |  |  132|  2.98k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.98k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.98k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.98k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8, False: 2.98k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.98k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.09k|        } else { \
  |  |  |  |  |  |  154|  4.09k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.09k|        } \
  |  |  |  |  |  |  156|  7.07k|    } \
  |  |  |  |  |  |  157|  9.39k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  9.39k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  9.39k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 3.76k, False: 5.62k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  9.39k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  9.39k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  9.39k|{ \
  |  |  |  |  |  |  326|  9.39k|    /* east */ \
  |  |  |  |  |  |  327|  9.39k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  9.39k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  9.39k| \
  |  |  |  |  |  |  329|  9.39k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  9.39k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  9.39k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  9.39k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  9.39k| \
  |  |  |  |  |  |  332|  9.39k|    /* west */ \
  |  |  |  |  |  |  333|  9.39k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  9.39k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  9.39k| \
  |  |  |  |  |  |  335|  9.39k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  9.39k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  9.39k| \
  |  |  |  |  |  |  343|  9.39k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  9.39k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  9.39k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  9.39k|            } \
  |  |  |  | 1142|  9.39k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  9.39k|    } \
  |  |  |  | 1144|  9.39k|}
  |  |  ------------------
  |  | 1285|  9.39k|                                            flags, flagsp, flags_stride, data, \
  |  | 1286|  9.39k|                                            l_w, 0, mqc, curctx, \
  |  | 1287|  9.39k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1288|  9.39k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  9.39k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1289|  9.39k|                        /* FALLTHRU */ \
  |  | 1290|  15.0k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1290:21): [True: 5.62k, False: 21.7k]
  |  |  ------------------
  |  | 1291|  15.0k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  15.0k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  15.0k|{ \
  |  |  |  | 1123|  15.0k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  15.0k|        do { \
  |  |  |  | 1125|  15.0k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 9.39k, False: 5.62k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  9.39k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  9.39k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  9.39k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  9.39k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  9.39k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  9.39k|{ \
  |  |  |  |  |  |  140|  9.39k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  9.39k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  9.39k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  9.39k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  9.39k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  9.39k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.45k, False: 6.93k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.45k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.45k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.45k|{ \
  |  |  |  |  |  |  |  |   57|  2.45k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 363, False: 2.09k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    363|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    363|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    363|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  2.09k|    } else { \
  |  |  |  |  |  |  |  |   62|  2.09k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  2.09k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  2.09k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  2.09k|    } \
  |  |  |  |  |  |  |  |   66|  2.45k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.45k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.45k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.45k|{ \
  |  |  |  |  |  |  |  |  128|  4.34k|    do { \
  |  |  |  |  |  |  |  |  129|  4.34k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 590, False: 3.75k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    590|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    590|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    590|{ \
  |  |  |  |  |  |  |  |  |  |  104|    590|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    590|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    590|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    590|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    590|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 494, False: 96]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    494|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 465, False: 29]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    465|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    465|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    465|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    465|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     29|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     29|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     29|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     29|            } \
  |  |  |  |  |  |  |  |  |  |  118|    494|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     96|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     96|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     96|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     96|        } \
  |  |  |  |  |  |  |  |  |  |  123|    590|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    590|        } \
  |  |  |  |  |  |  |  |  132|  4.34k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  4.34k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  4.34k|        ct--; \
  |  |  |  |  |  |  |  |  135|  4.34k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.89k, False: 2.45k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.45k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.93k|    } else {  \
  |  |  |  |  |  |  149|  6.93k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.93k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 3.00k, False: 3.93k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  3.00k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  3.00k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  3.00k|{ \
  |  |  |  |  |  |  |  |   45|  3.00k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 509, False: 2.49k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    509|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    509|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.49k|    } else { \
  |  |  |  |  |  |  |  |   49|  2.49k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.49k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.49k|    } \
  |  |  |  |  |  |  |  |   52|  3.00k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.00k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  3.00k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  3.00k|{ \
  |  |  |  |  |  |  |  |  128|  3.38k|    do { \
  |  |  |  |  |  |  |  |  129|  3.38k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 455, False: 2.93k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    455|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    455|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    455|{ \
  |  |  |  |  |  |  |  |  |  |  104|    455|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    455|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    455|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    455|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    455|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 391, False: 64]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    391|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 376, False: 15]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    376|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    376|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    376|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    376|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     15|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     15|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     15|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     15|            } \
  |  |  |  |  |  |  |  |  |  |  118|    391|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     64|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     64|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     64|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     64|        } \
  |  |  |  |  |  |  |  |  |  |  123|    455|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    455|        } \
  |  |  |  |  |  |  |  |  132|  3.38k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.38k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.38k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.38k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 385, False: 3.00k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  3.00k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.93k|        } else { \
  |  |  |  |  |  |  154|  3.93k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.93k|        } \
  |  |  |  |  |  |  156|  6.93k|    } \
  |  |  |  |  |  |  157|  9.39k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  9.39k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 6.05k, False: 3.33k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  9.39k|                    break; \
  |  |  |  | 1131|  9.39k|            } \
  |  |  |  | 1132|  15.0k|            { \
  |  |  |  | 1133|  8.96k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  8.96k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  8.96k|                                    ci); \
  |  |  |  | 1136|  8.96k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  8.96k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  8.96k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.96k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.96k|{ \
  |  |  |  |  |  |  140|  8.96k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.96k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.96k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.96k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.96k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.96k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.55k, False: 6.40k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.55k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.55k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.55k|{ \
  |  |  |  |  |  |  |  |   57|  2.55k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 115, False: 2.43k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    115|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    115|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    115|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  2.43k|    } else { \
  |  |  |  |  |  |  |  |   62|  2.43k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  2.43k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  2.43k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  2.43k|    } \
  |  |  |  |  |  |  |  |   66|  2.55k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.55k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.55k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.55k|{ \
  |  |  |  |  |  |  |  |  128|  3.93k|    do { \
  |  |  |  |  |  |  |  |  129|  3.93k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 398, False: 3.53k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    398|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    398|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    398|{ \
  |  |  |  |  |  |  |  |  |  |  104|    398|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    398|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    398|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    398|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    398|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 311, False: 87]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    311|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 286, False: 25]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    286|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    286|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    286|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    286|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     25|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     25|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     25|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     25|            } \
  |  |  |  |  |  |  |  |  |  |  118|    311|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     87|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     87|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     87|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     87|        } \
  |  |  |  |  |  |  |  |  |  |  123|    398|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    398|        } \
  |  |  |  |  |  |  |  |  132|  3.93k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.93k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.93k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.93k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.38k, False: 2.55k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.55k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.40k|    } else {  \
  |  |  |  |  |  |  149|  6.40k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.40k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.60k, False: 3.80k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.60k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.60k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.60k|{ \
  |  |  |  |  |  |  |  |   45|  2.60k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 365, False: 2.24k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    365|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    365|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.24k|    } else { \
  |  |  |  |  |  |  |  |   49|  2.24k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.24k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.24k|    } \
  |  |  |  |  |  |  |  |   52|  2.60k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.60k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.60k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.60k|{ \
  |  |  |  |  |  |  |  |  128|  2.91k|    do { \
  |  |  |  |  |  |  |  |  129|  2.91k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 538, False: 2.37k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    538|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    538|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    538|{ \
  |  |  |  |  |  |  |  |  |  |  104|    538|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    538|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    538|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    538|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    538|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 433, False: 105]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    433|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 417, False: 16]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    417|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    417|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    417|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    417|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     16|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     16|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     16|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     16|            } \
  |  |  |  |  |  |  |  |  |  |  118|    433|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    105|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    105|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    105|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    105|        } \
  |  |  |  |  |  |  |  |  |  |  123|    538|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    538|        } \
  |  |  |  |  |  |  |  |  132|  2.91k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.91k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.91k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.91k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 309, False: 2.60k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.60k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.80k|        } else { \
  |  |  |  |  |  |  154|  3.80k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.80k|        } \
  |  |  |  |  |  |  156|  6.40k|    } \
  |  |  |  |  |  |  157|  8.96k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  8.96k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  8.96k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 4.73k, False: 4.22k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  8.96k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  8.96k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  8.96k|{ \
  |  |  |  |  |  |  326|  8.96k|    /* east */ \
  |  |  |  |  |  |  327|  8.96k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  8.96k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  8.96k| \
  |  |  |  |  |  |  329|  8.96k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  8.96k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  8.96k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  8.96k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  8.96k| \
  |  |  |  |  |  |  332|  8.96k|    /* west */ \
  |  |  |  |  |  |  333|  8.96k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  8.96k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  8.96k| \
  |  |  |  |  |  |  335|  8.96k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  8.96k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  8.96k| \
  |  |  |  |  |  |  343|  8.96k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  8.96k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  8.96k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  8.96k|            } \
  |  |  |  | 1142|  8.96k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  15.0k|    } \
  |  |  |  | 1144|  15.0k|}
  |  |  ------------------
  |  | 1292|  15.0k|                                            flags, flagsp, flags_stride, data, \
  |  | 1293|  15.0k|                                            l_w, 1, mqc, curctx, \
  |  | 1294|  15.0k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1295|  15.0k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  15.0k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1296|  15.0k|                        /* FALLTHRU */ \
  |  | 1297|  22.6k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1297:21): [True: 7.61k, False: 19.7k]
  |  |  ------------------
  |  | 1298|  22.6k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  22.6k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  22.6k|{ \
  |  |  |  | 1123|  22.6k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  22.6k|        do { \
  |  |  |  | 1125|  22.6k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 15.0k, False: 7.61k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  15.0k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  15.0k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  15.0k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  15.0k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  15.0k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  15.0k|{ \
  |  |  |  |  |  |  140|  15.0k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  15.0k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  15.0k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  15.0k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  15.0k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  15.0k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 3.90k, False: 11.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  3.90k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  3.90k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  3.90k|{ \
  |  |  |  |  |  |  |  |   57|  3.90k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.06k, False: 2.83k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.06k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.06k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.06k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  2.83k|    } else { \
  |  |  |  |  |  |  |  |   62|  2.83k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  2.83k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  2.83k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  2.83k|    } \
  |  |  |  |  |  |  |  |   66|  3.90k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  3.90k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  3.90k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  3.90k|{ \
  |  |  |  |  |  |  |  |  128|  6.43k|    do { \
  |  |  |  |  |  |  |  |  129|  6.43k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 451, False: 5.98k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    451|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    451|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    451|{ \
  |  |  |  |  |  |  |  |  |  |  104|    451|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    451|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    451|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    451|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    451|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 316, False: 135]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    316|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 287, False: 29]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    287|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    287|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    287|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    287|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     29|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     29|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     29|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     29|            } \
  |  |  |  |  |  |  |  |  |  |  118|    316|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    135|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    135|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    135|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    135|        } \
  |  |  |  |  |  |  |  |  |  |  123|    451|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    451|        } \
  |  |  |  |  |  |  |  |  132|  6.43k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  6.43k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  6.43k|        ct--; \
  |  |  |  |  |  |  |  |  135|  6.43k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.52k, False: 3.90k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  3.90k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  11.1k|    } else {  \
  |  |  |  |  |  |  149|  11.1k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  11.1k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.52k, False: 8.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.52k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.52k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.52k|{ \
  |  |  |  |  |  |  |  |   45|  2.52k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 411, False: 2.11k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    411|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    411|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.11k|    } else { \
  |  |  |  |  |  |  |  |   49|  2.11k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.11k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.11k|    } \
  |  |  |  |  |  |  |  |   52|  2.52k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.52k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.52k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.52k|{ \
  |  |  |  |  |  |  |  |  128|  2.72k|    do { \
  |  |  |  |  |  |  |  |  129|  2.72k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 392, False: 2.33k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    392|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    392|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    392|{ \
  |  |  |  |  |  |  |  |  |  |  104|    392|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    392|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    392|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    392|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    392|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 260, False: 132]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    260|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 233, False: 27]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    233|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    233|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    233|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    233|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     27|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     27|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     27|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     27|            } \
  |  |  |  |  |  |  |  |  |  |  118|    260|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    132|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    132|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    132|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    132|        } \
  |  |  |  |  |  |  |  |  |  |  123|    392|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    392|        } \
  |  |  |  |  |  |  |  |  132|  2.72k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.72k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.72k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.72k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 200, False: 2.52k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.52k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  8.58k|        } else { \
  |  |  |  |  |  |  154|  8.58k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  8.58k|        } \
  |  |  |  |  |  |  156|  11.1k|    } \
  |  |  |  |  |  |  157|  15.0k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  15.0k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 10.4k, False: 4.53k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  15.0k|                    break; \
  |  |  |  | 1131|  15.0k|            } \
  |  |  |  | 1132|  22.6k|            { \
  |  |  |  | 1133|  12.1k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  12.1k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  12.1k|                                    ci); \
  |  |  |  | 1136|  12.1k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  12.1k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  12.1k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  12.1k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  12.1k|{ \
  |  |  |  |  |  |  140|  12.1k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  12.1k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  12.1k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  12.1k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  12.1k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  12.1k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 3.28k, False: 8.86k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  3.28k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  3.28k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  3.28k|{ \
  |  |  |  |  |  |  |  |   57|  3.28k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 507, False: 2.77k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    507|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    507|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    507|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  2.77k|    } else { \
  |  |  |  |  |  |  |  |   62|  2.77k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  2.77k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  2.77k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  2.77k|    } \
  |  |  |  |  |  |  |  |   66|  3.28k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  3.28k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  3.28k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  3.28k|{ \
  |  |  |  |  |  |  |  |  128|  5.02k|    do { \
  |  |  |  |  |  |  |  |  129|  5.02k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 451, False: 4.57k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    451|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    451|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    451|{ \
  |  |  |  |  |  |  |  |  |  |  104|    451|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    451|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    451|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    451|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    451|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 373, False: 78]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    373|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 338, False: 35]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    338|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    338|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    338|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    338|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     35|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     35|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     35|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     35|            } \
  |  |  |  |  |  |  |  |  |  |  118|    373|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     78|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     78|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     78|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     78|        } \
  |  |  |  |  |  |  |  |  |  |  123|    451|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    451|        } \
  |  |  |  |  |  |  |  |  132|  5.02k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  5.02k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  5.02k|        ct--; \
  |  |  |  |  |  |  |  |  135|  5.02k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.74k, False: 3.28k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  3.28k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.86k|    } else {  \
  |  |  |  |  |  |  149|  8.86k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.86k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 4.46k, False: 4.39k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  4.46k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  4.46k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  4.46k|{ \
  |  |  |  |  |  |  |  |   45|  4.46k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 203, False: 4.26k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    203|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    203|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  4.26k|    } else { \
  |  |  |  |  |  |  |  |   49|  4.26k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  4.26k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  4.26k|    } \
  |  |  |  |  |  |  |  |   52|  4.46k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  4.46k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  4.46k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  4.46k|{ \
  |  |  |  |  |  |  |  |  128|  4.56k|    do { \
  |  |  |  |  |  |  |  |  129|  4.56k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 313, False: 4.25k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    313|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    313|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    313|{ \
  |  |  |  |  |  |  |  |  |  |  104|    313|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    313|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    313|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    313|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    313|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 234, False: 79]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    234|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 217, False: 17]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    217|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    217|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    217|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    217|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     17|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     17|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     17|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     17|            } \
  |  |  |  |  |  |  |  |  |  |  118|    234|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     79|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     79|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     79|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     79|        } \
  |  |  |  |  |  |  |  |  |  |  123|    313|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    313|        } \
  |  |  |  |  |  |  |  |  132|  4.56k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  4.56k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  4.56k|        ct--; \
  |  |  |  |  |  |  |  |  135|  4.56k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 100, False: 4.46k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  4.46k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.46k|        } else { \
  |  |  |  |  |  |  154|  4.39k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.39k|        } \
  |  |  |  |  |  |  156|  8.86k|    } \
  |  |  |  |  |  |  157|  12.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  12.1k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  12.1k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 5.57k, False: 6.57k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  12.1k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  12.1k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  12.1k|{ \
  |  |  |  |  |  |  326|  12.1k|    /* east */ \
  |  |  |  |  |  |  327|  12.1k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  12.1k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  12.1k| \
  |  |  |  |  |  |  329|  12.1k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  12.1k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  12.1k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  12.1k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  12.1k| \
  |  |  |  |  |  |  332|  12.1k|    /* west */ \
  |  |  |  |  |  |  333|  12.1k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  12.1k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  12.1k| \
  |  |  |  |  |  |  335|  12.1k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  12.1k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  12.1k| \
  |  |  |  |  |  |  343|  12.1k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  12.1k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  12.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  12.1k|            } \
  |  |  |  | 1142|  12.1k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  22.6k|    } \
  |  |  |  | 1144|  22.6k|}
  |  |  ------------------
  |  | 1299|  22.6k|                                            flags, flagsp, flags_stride, data, \
  |  | 1300|  22.6k|                                            l_w, 2, mqc, curctx, \
  |  | 1301|  22.6k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1302|  22.6k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  22.6k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1303|  22.6k|                        /* FALLTHRU */ \
  |  | 1304|  27.3k|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1304:21): [True: 4.76k, False: 22.6k]
  |  |  ------------------
  |  | 1305|  27.3k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  27.3k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  27.3k|{ \
  |  |  |  | 1123|  27.3k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  27.3k|        do { \
  |  |  |  | 1125|  27.3k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 22.6k, False: 4.76k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  22.6k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  22.6k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  22.6k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  22.6k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  22.6k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  22.6k|{ \
  |  |  |  |  |  |  140|  22.6k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  22.6k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  22.6k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  22.6k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  22.6k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  22.6k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 3.27k, False: 19.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  3.27k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  3.27k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  3.27k|{ \
  |  |  |  |  |  |  |  |   57|  3.27k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 584, False: 2.68k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    584|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    584|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    584|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  2.68k|    } else { \
  |  |  |  |  |  |  |  |   62|  2.68k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  2.68k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  2.68k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  2.68k|    } \
  |  |  |  |  |  |  |  |   66|  3.27k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  3.27k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  3.27k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  3.27k|{ \
  |  |  |  |  |  |  |  |  128|  5.39k|    do { \
  |  |  |  |  |  |  |  |  129|  5.39k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 547, False: 4.84k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    547|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    547|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    547|{ \
  |  |  |  |  |  |  |  |  |  |  104|    547|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    547|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    547|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    547|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    547|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 401, False: 146]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    401|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 370, False: 31]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    370|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    370|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    370|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    370|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     31|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     31|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     31|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     31|            } \
  |  |  |  |  |  |  |  |  |  |  118|    401|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    146|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    146|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    146|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    146|        } \
  |  |  |  |  |  |  |  |  |  |  123|    547|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    547|        } \
  |  |  |  |  |  |  |  |  132|  5.39k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  5.39k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  5.39k|        ct--; \
  |  |  |  |  |  |  |  |  135|  5.39k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.12k, False: 3.27k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  3.27k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  19.3k|    } else {  \
  |  |  |  |  |  |  149|  19.3k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  19.3k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 4.99k, False: 14.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  4.99k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  4.99k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  4.99k|{ \
  |  |  |  |  |  |  |  |   45|  4.99k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 695, False: 4.30k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    695|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    695|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  4.30k|    } else { \
  |  |  |  |  |  |  |  |   49|  4.30k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  4.30k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  4.30k|    } \
  |  |  |  |  |  |  |  |   52|  4.99k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  4.99k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  4.99k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  4.99k|{ \
  |  |  |  |  |  |  |  |  128|  5.49k|    do { \
  |  |  |  |  |  |  |  |  129|  5.49k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 625, False: 4.87k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    625|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    625|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    625|{ \
  |  |  |  |  |  |  |  |  |  |  104|    625|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    625|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    625|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    625|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    625|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 529, False: 96]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    529|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 514, False: 15]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    514|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    514|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    514|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    514|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     15|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     15|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     15|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     15|            } \
  |  |  |  |  |  |  |  |  |  |  118|    529|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     96|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     96|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     96|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     96|        } \
  |  |  |  |  |  |  |  |  |  |  123|    625|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    625|        } \
  |  |  |  |  |  |  |  |  132|  5.49k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  5.49k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  5.49k|        ct--; \
  |  |  |  |  |  |  |  |  135|  5.49k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 499, False: 4.99k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  4.99k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  14.3k|        } else { \
  |  |  |  |  |  |  154|  14.3k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  14.3k|        } \
  |  |  |  |  |  |  156|  19.3k|    } \
  |  |  |  |  |  |  157|  22.6k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  22.6k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 17.0k, False: 5.57k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  22.6k|                    break; \
  |  |  |  | 1131|  22.6k|            } \
  |  |  |  | 1132|  27.3k|            { \
  |  |  |  | 1133|  10.3k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  10.3k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  10.3k|                                    ci); \
  |  |  |  | 1136|  10.3k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  10.3k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  10.3k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.3k|{ \
  |  |  |  |  |  |  140|  10.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.85k, False: 7.48k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.85k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.85k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.85k|{ \
  |  |  |  |  |  |  |  |   57|  2.85k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 595, False: 2.25k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    595|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    595|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    595|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  2.25k|    } else { \
  |  |  |  |  |  |  |  |   62|  2.25k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  2.25k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  2.25k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  2.25k|    } \
  |  |  |  |  |  |  |  |   66|  2.85k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.85k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.85k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.85k|{ \
  |  |  |  |  |  |  |  |  128|  4.58k|    do { \
  |  |  |  |  |  |  |  |  129|  4.58k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.16k, False: 3.41k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.16k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.16k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.16k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.16k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.16k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.16k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.16k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.16k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.04k, False: 123]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.04k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.02k, False: 17]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.02k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.02k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.02k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.02k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     17|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     17|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     17|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     17|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.04k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    123|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    123|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    123|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    123|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.16k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.16k|        } \
  |  |  |  |  |  |  |  |  132|  4.58k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  4.58k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  4.58k|        ct--; \
  |  |  |  |  |  |  |  |  135|  4.58k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.73k, False: 2.85k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.85k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  7.48k|    } else {  \
  |  |  |  |  |  |  149|  7.48k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  7.48k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 3.12k, False: 4.36k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  3.12k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  3.12k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  3.12k|{ \
  |  |  |  |  |  |  |  |   45|  3.12k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 513, False: 2.60k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    513|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    513|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.60k|    } else { \
  |  |  |  |  |  |  |  |   49|  2.60k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.60k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.60k|    } \
  |  |  |  |  |  |  |  |   52|  3.12k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.12k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  3.12k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  3.12k|{ \
  |  |  |  |  |  |  |  |  128|  3.25k|    do { \
  |  |  |  |  |  |  |  |  129|  3.25k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 576, False: 2.67k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    576|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    576|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    576|{ \
  |  |  |  |  |  |  |  |  |  |  104|    576|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    576|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    576|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    576|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    576|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 504, False: 72]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    504|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 490, False: 14]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    490|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    490|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    490|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    490|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     14|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     14|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     14|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     14|            } \
  |  |  |  |  |  |  |  |  |  |  118|    504|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     72|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     72|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     72|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     72|        } \
  |  |  |  |  |  |  |  |  |  |  123|    576|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    576|        } \
  |  |  |  |  |  |  |  |  132|  3.25k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.25k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.25k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.25k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 130, False: 3.12k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  3.12k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.36k|        } else { \
  |  |  |  |  |  |  154|  4.36k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.36k|        } \
  |  |  |  |  |  |  156|  7.48k|    } \
  |  |  |  |  |  |  157|  10.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  10.3k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  10.3k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 5.21k, False: 5.11k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.3k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  10.3k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  10.3k|{ \
  |  |  |  |  |  |  326|  10.3k|    /* east */ \
  |  |  |  |  |  |  327|  10.3k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  10.3k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  10.3k| \
  |  |  |  |  |  |  329|  10.3k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  10.3k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  10.3k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  10.3k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  10.3k| \
  |  |  |  |  |  |  332|  10.3k|    /* west */ \
  |  |  |  |  |  |  333|  10.3k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  10.3k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  10.3k| \
  |  |  |  |  |  |  335|  10.3k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  10.3k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  10.3k| \
  |  |  |  |  |  |  343|  10.3k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  10.3k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  10.3k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|  10.3k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  10.3k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  10.3k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|  10.3k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  10.3k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  10.3k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  10.3k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|  10.3k|    } \
  |  |  |  |  |  |  350|  10.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  10.3k|            } \
  |  |  |  | 1142|  10.3k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  27.3k|    } \
  |  |  |  | 1144|  27.3k|}
  |  |  ------------------
  |  | 1306|  27.3k|                                            flags, flagsp, flags_stride, data, \
  |  | 1307|  27.3k|                                            l_w, 3, mqc, curctx, \
  |  | 1308|  27.3k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1309|  27.3k|                        break; \
  |  | 1310|  27.3k|                } \
  |  | 1311|  2.03M|            } else { \
  |  | 1312|  2.03M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.03M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.03M|{ \
  |  |  |  | 1123|  2.03M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.03M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.03M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.03M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.03M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 385k, False: 1.65M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   385k|        do { \
  |  |  |  | 1125|   385k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   385k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   385k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   385k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   385k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   385k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   385k|{ \
  |  |  |  |  |  |  140|   385k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   385k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   385k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   385k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   385k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   385k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 84.2k, False: 300k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  84.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  84.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  84.2k|{ \
  |  |  |  |  |  |  |  |   57|  84.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 16.5k, False: 67.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  16.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  16.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  16.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  67.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  67.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  67.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  67.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  67.7k|    } \
  |  |  |  |  |  |  |  |   66|  84.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  84.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  84.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  84.2k|{ \
  |  |  |  |  |  |  |  |  128|   138k|    do { \
  |  |  |  |  |  |  |  |  129|   138k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.7k, False: 121k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 15.8k, False: 936]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.6k, False: 212]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    212|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    212|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    212|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    212|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    936|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    936|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    936|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    936|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.7k|        } \
  |  |  |  |  |  |  |  |  132|   138k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   138k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   138k|        ct--; \
  |  |  |  |  |  |  |  |  135|   138k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 54.2k, False: 84.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  84.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   300k|    } else {  \
  |  |  |  |  |  |  149|   300k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   300k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 95.3k, False: 205k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  95.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  95.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  95.3k|{ \
  |  |  |  |  |  |  |  |   45|  95.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 14.9k, False: 80.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  14.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  14.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  80.3k|    } else { \
  |  |  |  |  |  |  |  |   49|  80.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  80.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  80.3k|    } \
  |  |  |  |  |  |  |  |   52|  95.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  95.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  95.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  95.3k|{ \
  |  |  |  |  |  |  |  |  128|   101k|    do { \
  |  |  |  |  |  |  |  |  129|   101k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.7k, False: 90.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  11.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  11.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  11.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  11.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  11.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  11.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  11.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  11.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.0k, False: 683]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.9k, False: 148]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    148|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    148|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    148|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    148|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    683|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    683|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    683|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    683|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.7k|        } \
  |  |  |  |  |  |  |  |  132|   101k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   101k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   101k|        ct--; \
  |  |  |  |  |  |  |  |  135|   101k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.60k, False: 95.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  95.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   205k|        } else { \
  |  |  |  |  |  |  154|   205k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   205k|        } \
  |  |  |  |  |  |  156|   300k|    } \
  |  |  |  |  |  |  157|   385k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   385k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 213k, False: 171k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   385k|                    break; \
  |  |  |  | 1131|   385k|            } \
  |  |  |  | 1132|   385k|            { \
  |  |  |  | 1133|   171k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   171k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   171k|                                    ci); \
  |  |  |  | 1136|   171k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   171k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   171k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   171k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   171k|{ \
  |  |  |  |  |  |  140|   171k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   171k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   171k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   171k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   171k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   171k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 46.5k, False: 125k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  46.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  46.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  46.5k|{ \
  |  |  |  |  |  |  |  |   57|  46.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 8.31k, False: 38.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  8.31k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  8.31k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  8.31k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  38.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  38.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  38.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  38.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  38.2k|    } \
  |  |  |  |  |  |  |  |   66|  46.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  46.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  46.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  46.5k|{ \
  |  |  |  |  |  |  |  |  128|  74.5k|    do { \
  |  |  |  |  |  |  |  |  129|  74.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 8.20k, False: 66.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  8.20k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  8.20k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  8.20k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  8.20k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  8.20k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  8.20k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  8.20k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  8.20k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.68k, False: 527]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.68k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.56k, False: 117]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.56k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.56k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.56k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.56k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    117|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    117|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    117|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    117|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.68k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    527|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    527|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    527|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    527|        } \
  |  |  |  |  |  |  |  |  |  |  123|  8.20k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  8.20k|        } \
  |  |  |  |  |  |  |  |  132|  74.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  74.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  74.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  74.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 27.9k, False: 46.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  46.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   125k|    } else {  \
  |  |  |  |  |  |  149|   125k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   125k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 48.8k, False: 76.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  48.8k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  48.8k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  48.8k|{ \
  |  |  |  |  |  |  |  |   45|  48.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 7.38k, False: 41.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  7.38k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  7.38k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  41.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  41.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  41.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  41.4k|    } \
  |  |  |  |  |  |  |  |   52|  48.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  48.8k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  48.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  48.8k|{ \
  |  |  |  |  |  |  |  |  128|  52.3k|    do { \
  |  |  |  |  |  |  |  |  129|  52.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.83k, False: 46.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.83k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.83k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.83k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.83k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.83k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.83k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.83k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.83k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.45k, False: 383]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.45k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.38k, False: 69]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.38k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.38k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.38k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.38k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     69|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     69|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     69|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     69|            } \
  |  |  |  |  |  |  |  |  |  |  118|  5.45k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    383|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    383|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    383|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    383|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.83k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.83k|        } \
  |  |  |  |  |  |  |  |  132|  52.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  52.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  52.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  52.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 3.55k, False: 48.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  48.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  76.5k|        } else { \
  |  |  |  |  |  |  154|  76.5k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  76.5k|        } \
  |  |  |  |  |  |  156|   125k|    } \
  |  |  |  |  |  |  157|   171k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   171k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   171k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 78.1k, False: 93.7k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   171k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   171k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   171k|{ \
  |  |  |  |  |  |  326|   171k|    /* east */ \
  |  |  |  |  |  |  327|   171k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   171k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   171k| \
  |  |  |  |  |  |  329|   171k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   171k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   171k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   171k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   171k| \
  |  |  |  |  |  |  332|   171k|    /* west */ \
  |  |  |  |  |  |  333|   171k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   171k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   171k| \
  |  |  |  |  |  |  335|   171k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   171k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   171k| \
  |  |  |  |  |  |  343|   171k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   171k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   171k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   171k|            } \
  |  |  |  | 1142|   171k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   385k|    } \
  |  |  |  | 1144|  2.03M|}
  |  |  ------------------
  |  | 1313|  2.03M|                                    flags, flagsp, flags_stride, data, \
  |  | 1314|  2.03M|                                    l_w, 0, mqc, curctx, \
  |  | 1315|  2.03M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1316|  2.03M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.03M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.03M|{ \
  |  |  |  | 1123|  2.03M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.03M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.03M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.03M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.03M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 385k, False: 1.64M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   385k|        do { \
  |  |  |  | 1125|   385k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   385k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   385k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   385k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   385k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   385k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   385k|{ \
  |  |  |  |  |  |  140|   385k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   385k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   385k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   385k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   385k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   385k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 84.7k, False: 301k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  84.7k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  84.7k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  84.7k|{ \
  |  |  |  |  |  |  |  |   57|  84.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.3k, False: 66.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  66.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  66.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  66.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  66.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  66.4k|    } \
  |  |  |  |  |  |  |  |   66|  84.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  84.7k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  84.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  84.7k|{ \
  |  |  |  |  |  |  |  |  128|   144k|    do { \
  |  |  |  |  |  |  |  |  129|   144k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 20.8k, False: 123k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  20.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  20.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  20.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  20.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  20.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  20.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  20.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  20.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 19.9k, False: 858]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  19.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19.7k, False: 205]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  19.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  19.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  19.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  19.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    205|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    205|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    205|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    205|            } \
  |  |  |  |  |  |  |  |  |  |  118|  19.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    858|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    858|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    858|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    858|        } \
  |  |  |  |  |  |  |  |  |  |  123|  20.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  20.8k|        } \
  |  |  |  |  |  |  |  |  132|   144k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   144k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   144k|        ct--; \
  |  |  |  |  |  |  |  |  135|   144k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 59.7k, False: 84.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  84.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   301k|    } else {  \
  |  |  |  |  |  |  149|   301k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   301k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 92.7k, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  92.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  92.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  92.7k|{ \
  |  |  |  |  |  |  |  |   45|  92.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 12.6k, False: 80.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  12.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  12.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  80.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  80.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  80.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  80.1k|    } \
  |  |  |  |  |  |  |  |   52|  92.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  92.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  92.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  92.7k|{ \
  |  |  |  |  |  |  |  |  128|  98.2k|    do { \
  |  |  |  |  |  |  |  |  129|  98.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.0k, False: 86.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  12.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  12.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  12.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  12.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  12.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  12.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  12.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  12.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.4k, False: 626]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.3k, False: 125]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    125|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    125|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    125|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    125|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    626|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    626|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    626|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    626|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.0k|        } \
  |  |  |  |  |  |  |  |  132|  98.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  98.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  98.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  98.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.48k, False: 92.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  92.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   208k|        } else { \
  |  |  |  |  |  |  154|   208k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   208k|        } \
  |  |  |  |  |  |  156|   301k|    } \
  |  |  |  |  |  |  157|   385k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   385k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 208k, False: 177k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   385k|                    break; \
  |  |  |  | 1131|   385k|            } \
  |  |  |  | 1132|   385k|            { \
  |  |  |  | 1133|   177k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   177k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   177k|                                    ci); \
  |  |  |  | 1136|   177k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   177k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   177k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   177k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   177k|{ \
  |  |  |  |  |  |  140|   177k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   177k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   177k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   177k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   177k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   177k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 50.4k, False: 126k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  50.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  50.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  50.4k|{ \
  |  |  |  |  |  |  |  |   57|  50.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 10.7k, False: 39.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  10.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  10.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  10.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  39.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  39.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  39.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  39.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  39.7k|    } \
  |  |  |  |  |  |  |  |   66|  50.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  50.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  50.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  50.4k|{ \
  |  |  |  |  |  |  |  |  128|  83.2k|    do { \
  |  |  |  |  |  |  |  |  129|  83.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 10.8k, False: 72.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  10.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  10.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  10.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  10.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  10.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  10.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  10.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  10.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 10.3k, False: 520]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  10.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.2k, False: 82]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     82|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     82|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     82|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     82|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    520|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    520|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    520|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    520|        } \
  |  |  |  |  |  |  |  |  |  |  123|  10.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  10.8k|        } \
  |  |  |  |  |  |  |  |  132|  83.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  83.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  83.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  83.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 32.7k, False: 50.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  50.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   126k|    } else {  \
  |  |  |  |  |  |  149|   126k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   126k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 48.8k, False: 78.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  48.8k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  48.8k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  48.8k|{ \
  |  |  |  |  |  |  |  |   45|  48.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 7.89k, False: 40.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  7.89k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  7.89k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  40.9k|    } else { \
  |  |  |  |  |  |  |  |   49|  40.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  40.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  40.9k|    } \
  |  |  |  |  |  |  |  |   52|  48.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  48.8k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  48.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  48.8k|{ \
  |  |  |  |  |  |  |  |  128|  52.9k|    do { \
  |  |  |  |  |  |  |  |  129|  52.9k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.61k, False: 46.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.61k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.61k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.61k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.61k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.61k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.61k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.61k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.61k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.21k, False: 392]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.21k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.16k, False: 55]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.16k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.16k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.16k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.16k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     55|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     55|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     55|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     55|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.21k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    392|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    392|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    392|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    392|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.61k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.61k|        } \
  |  |  |  |  |  |  |  |  132|  52.9k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  52.9k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  52.9k|        ct--; \
  |  |  |  |  |  |  |  |  135|  52.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.05k, False: 48.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  48.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  78.0k|        } else { \
  |  |  |  |  |  |  154|  78.0k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  78.0k|        } \
  |  |  |  |  |  |  156|   126k|    } \
  |  |  |  |  |  |  157|   177k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   177k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   177k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 86.9k, False: 90.3k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   177k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   177k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   177k|{ \
  |  |  |  |  |  |  326|   177k|    /* east */ \
  |  |  |  |  |  |  327|   177k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   177k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   177k| \
  |  |  |  |  |  |  329|   177k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   177k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   177k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   177k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   177k| \
  |  |  |  |  |  |  332|   177k|    /* west */ \
  |  |  |  |  |  |  333|   177k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   177k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   177k| \
  |  |  |  |  |  |  335|   177k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   177k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   177k| \
  |  |  |  |  |  |  343|   177k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   177k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   177k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   177k|            } \
  |  |  |  | 1142|   177k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   385k|    } \
  |  |  |  | 1144|  2.03M|}
  |  |  ------------------
  |  | 1317|  2.03M|                                    flags, flagsp, flags_stride, data, \
  |  | 1318|  2.03M|                                    l_w, 1, mqc, curctx, \
  |  | 1319|  2.03M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1320|  2.03M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.03M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.03M|{ \
  |  |  |  | 1123|  2.03M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.03M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.03M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.03M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.03M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 390k, False: 1.64M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   390k|        do { \
  |  |  |  | 1125|   390k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   390k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   390k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   390k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   390k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   390k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   390k|{ \
  |  |  |  |  |  |  140|   390k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   390k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   390k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   390k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   390k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   390k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 83.4k, False: 306k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  83.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  83.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  83.4k|{ \
  |  |  |  |  |  |  |  |   57|  83.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 16.6k, False: 66.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  16.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  16.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  16.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  66.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  66.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  66.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  66.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  66.7k|    } \
  |  |  |  |  |  |  |  |   66|  83.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  83.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  83.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  83.4k|{ \
  |  |  |  |  |  |  |  |  128|   139k|    do { \
  |  |  |  |  |  |  |  |  129|   139k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.2k, False: 122k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  17.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  17.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  17.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  17.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  17.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  17.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  17.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  17.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16.4k, False: 816]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  16.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16.2k, False: 155]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  16.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  16.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  16.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  16.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    155|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    155|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    155|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    155|            } \
  |  |  |  |  |  |  |  |  |  |  118|  16.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    816|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    816|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    816|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    816|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.2k|        } \
  |  |  |  |  |  |  |  |  132|   139k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   139k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   139k|        ct--; \
  |  |  |  |  |  |  |  |  135|   139k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.8k, False: 83.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  83.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   306k|    } else {  \
  |  |  |  |  |  |  149|   306k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   306k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 89.3k, False: 217k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  89.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  89.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  89.3k|{ \
  |  |  |  |  |  |  |  |   45|  89.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.5k, False: 77.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  77.7k|    } else { \
  |  |  |  |  |  |  |  |   49|  77.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  77.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  77.7k|    } \
  |  |  |  |  |  |  |  |   52|  89.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  89.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  89.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  89.3k|{ \
  |  |  |  |  |  |  |  |  128|  94.2k|    do { \
  |  |  |  |  |  |  |  |  129|  94.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 10.2k, False: 84.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  10.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  10.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  10.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  10.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  10.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  10.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  10.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  10.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.61k, False: 625]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.61k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.48k, False: 130]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.48k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.48k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.48k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.48k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    130|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    130|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    130|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    130|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.61k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    625|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    625|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    625|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    625|        } \
  |  |  |  |  |  |  |  |  |  |  123|  10.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  10.2k|        } \
  |  |  |  |  |  |  |  |  132|  94.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  94.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  94.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  94.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.90k, False: 89.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  89.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   217k|        } else { \
  |  |  |  |  |  |  154|   217k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   217k|        } \
  |  |  |  |  |  |  156|   306k|    } \
  |  |  |  |  |  |  157|   390k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   390k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 215k, False: 175k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   390k|                    break; \
  |  |  |  | 1131|   390k|            } \
  |  |  |  | 1132|   390k|            { \
  |  |  |  | 1133|   175k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   175k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   175k|                                    ci); \
  |  |  |  | 1136|   175k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   175k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   175k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   175k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   175k|{ \
  |  |  |  |  |  |  140|   175k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   175k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   175k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   175k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   175k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   175k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 46.2k, False: 128k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  46.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  46.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  46.2k|{ \
  |  |  |  |  |  |  |  |   57|  46.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 9.58k, False: 36.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  9.58k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  9.58k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  9.58k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  36.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  36.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  36.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  36.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  36.7k|    } \
  |  |  |  |  |  |  |  |   66|  46.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  46.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  46.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  46.2k|{ \
  |  |  |  |  |  |  |  |  128|  77.4k|    do { \
  |  |  |  |  |  |  |  |  129|  77.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 10.9k, False: 66.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  10.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  10.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  10.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  10.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  10.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  10.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  10.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  10.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 10.3k, False: 593]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  10.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.2k, False: 81]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     81|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     81|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     81|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     81|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    593|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    593|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    593|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    593|        } \
  |  |  |  |  |  |  |  |  |  |  123|  10.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  10.9k|        } \
  |  |  |  |  |  |  |  |  132|  77.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  77.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  77.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  77.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 31.1k, False: 46.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  46.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   128k|    } else {  \
  |  |  |  |  |  |  149|   128k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   128k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 49.9k, False: 78.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  49.9k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  49.9k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  49.9k|{ \
  |  |  |  |  |  |  |  |   45|  49.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.89k, False: 43.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.89k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.89k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  43.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  43.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  43.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  43.0k|    } \
  |  |  |  |  |  |  |  |   52|  49.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  49.9k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  49.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  49.9k|{ \
  |  |  |  |  |  |  |  |  128|  52.8k|    do { \
  |  |  |  |  |  |  |  |  129|  52.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.17k, False: 46.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.17k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.17k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.17k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.17k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.17k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.17k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.17k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.17k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.80k, False: 369]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.80k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.75k, False: 50]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.75k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.75k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.75k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.75k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     50|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     50|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     50|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     50|            } \
  |  |  |  |  |  |  |  |  |  |  118|  5.80k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    369|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    369|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    369|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    369|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.17k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.17k|        } \
  |  |  |  |  |  |  |  |  132|  52.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  52.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  52.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  52.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.82k, False: 49.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  49.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  78.8k|        } else { \
  |  |  |  |  |  |  154|  78.8k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  78.8k|        } \
  |  |  |  |  |  |  156|   128k|    } \
  |  |  |  |  |  |  157|   175k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   175k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   175k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 82.7k, False: 92.3k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   175k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   175k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   175k|{ \
  |  |  |  |  |  |  326|   175k|    /* east */ \
  |  |  |  |  |  |  327|   175k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   175k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   175k| \
  |  |  |  |  |  |  329|   175k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   175k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   175k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   175k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   175k| \
  |  |  |  |  |  |  332|   175k|    /* west */ \
  |  |  |  |  |  |  333|   175k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   175k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   175k| \
  |  |  |  |  |  |  335|   175k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   175k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   175k| \
  |  |  |  |  |  |  343|   175k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   175k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   175k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   175k|            } \
  |  |  |  | 1142|   175k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   390k|    } \
  |  |  |  | 1144|  2.03M|}
  |  |  ------------------
  |  | 1321|  2.03M|                                    flags, flagsp, flags_stride, data, \
  |  | 1322|  2.03M|                                    l_w, 2, mqc, curctx, \
  |  | 1323|  2.03M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1324|  2.03M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.03M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.03M|{ \
  |  |  |  | 1123|  2.03M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.03M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.03M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.03M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.03M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 404k, False: 1.63M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   404k|        do { \
  |  |  |  | 1125|   404k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   404k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   404k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   404k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   404k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   404k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   404k|{ \
  |  |  |  |  |  |  140|   404k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   404k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   404k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   404k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   404k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   404k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 78.2k, False: 326k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  78.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  78.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  78.2k|{ \
  |  |  |  |  |  |  |  |   57|  78.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 14.9k, False: 63.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  14.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  14.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  14.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  63.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  63.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  63.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  63.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  63.2k|    } \
  |  |  |  |  |  |  |  |   66|  78.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  78.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  78.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  78.2k|{ \
  |  |  |  |  |  |  |  |  128|   138k|    do { \
  |  |  |  |  |  |  |  |  129|   138k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 18.1k, False: 120k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  18.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  18.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  18.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  18.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  18.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  18.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  18.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  18.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 17.4k, False: 792]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  17.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 17.2k, False: 180]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  17.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  17.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  17.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  17.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    180|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    180|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    180|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    180|            } \
  |  |  |  |  |  |  |  |  |  |  118|  17.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    792|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    792|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    792|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    792|        } \
  |  |  |  |  |  |  |  |  |  |  123|  18.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  18.1k|        } \
  |  |  |  |  |  |  |  |  132|   138k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   138k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   138k|        ct--; \
  |  |  |  |  |  |  |  |  135|   138k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 59.9k, False: 78.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  78.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   326k|    } else {  \
  |  |  |  |  |  |  149|   326k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   326k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 79.9k, False: 246k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  79.9k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  79.9k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  79.9k|{ \
  |  |  |  |  |  |  |  |   45|  79.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 9.53k, False: 70.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  9.53k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  9.53k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  70.3k|    } else { \
  |  |  |  |  |  |  |  |   49|  70.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  70.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  70.3k|    } \
  |  |  |  |  |  |  |  |   52|  79.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  79.9k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  79.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  79.9k|{ \
  |  |  |  |  |  |  |  |  128|  84.6k|    do { \
  |  |  |  |  |  |  |  |  129|  84.6k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 10.3k, False: 74.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  10.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  10.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  10.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  10.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  10.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  10.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  10.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  10.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.83k, False: 514]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.83k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.71k, False: 117]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.71k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.71k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.71k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.71k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    117|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    117|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    117|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    117|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.83k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    514|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    514|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    514|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    514|        } \
  |  |  |  |  |  |  |  |  |  |  123|  10.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  10.3k|        } \
  |  |  |  |  |  |  |  |  132|  84.6k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  84.6k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  84.6k|        ct--; \
  |  |  |  |  |  |  |  |  135|  84.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.78k, False: 79.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  79.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   246k|        } else { \
  |  |  |  |  |  |  154|   246k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   246k|        } \
  |  |  |  |  |  |  156|   326k|    } \
  |  |  |  |  |  |  157|   404k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   404k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 249k, False: 155k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   404k|                    break; \
  |  |  |  | 1131|   404k|            } \
  |  |  |  | 1132|   404k|            { \
  |  |  |  | 1133|   155k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   155k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   155k|                                    ci); \
  |  |  |  | 1136|   155k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   155k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   155k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   155k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   155k|{ \
  |  |  |  |  |  |  140|   155k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   155k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   155k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   155k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   155k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   155k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 40.5k, False: 114k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  40.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  40.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  40.5k|{ \
  |  |  |  |  |  |  |  |   57|  40.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 9.16k, False: 31.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  9.16k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  9.16k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  9.16k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  31.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  31.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  31.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  31.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  31.4k|    } \
  |  |  |  |  |  |  |  |   66|  40.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  40.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  40.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  40.5k|{ \
  |  |  |  |  |  |  |  |  128|  66.4k|    do { \
  |  |  |  |  |  |  |  |  129|  66.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 8.65k, False: 57.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  8.65k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  8.65k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  8.65k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  8.65k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  8.65k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  8.65k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  8.65k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  8.65k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8.13k, False: 518]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  8.13k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.01k, False: 115]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  8.01k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  8.01k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  8.01k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  8.01k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    115|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    115|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    115|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    115|            } \
  |  |  |  |  |  |  |  |  |  |  118|  8.13k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    518|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    518|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    518|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    518|        } \
  |  |  |  |  |  |  |  |  |  |  123|  8.65k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  8.65k|        } \
  |  |  |  |  |  |  |  |  132|  66.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  66.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  66.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  66.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 25.8k, False: 40.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  40.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   114k|    } else {  \
  |  |  |  |  |  |  149|   114k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   114k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 44.9k, False: 69.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  44.9k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  44.9k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  44.9k|{ \
  |  |  |  |  |  |  |  |   45|  44.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.42k, False: 38.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.42k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.42k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  38.5k|    } else { \
  |  |  |  |  |  |  |  |   49|  38.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  38.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  38.5k|    } \
  |  |  |  |  |  |  |  |   52|  44.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  44.9k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  44.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  44.9k|{ \
  |  |  |  |  |  |  |  |  128|  48.1k|    do { \
  |  |  |  |  |  |  |  |  129|  48.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.57k, False: 41.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.57k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.57k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.57k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.57k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.57k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.57k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.57k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.57k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.26k, False: 310]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.26k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.22k, False: 45]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.22k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.22k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.22k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.22k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     45|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     45|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     45|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     45|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.26k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    310|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    310|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    310|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    310|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.57k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.57k|        } \
  |  |  |  |  |  |  |  |  132|  48.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  48.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  48.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  48.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 3.12k, False: 44.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  44.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|        } else { \
  |  |  |  |  |  |  154|  69.4k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  69.4k|        } \
  |  |  |  |  |  |  156|   114k|    } \
  |  |  |  |  |  |  157|   155k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   155k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   155k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 73.9k, False: 81.0k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   155k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   155k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   155k|{ \
  |  |  |  |  |  |  326|   155k|    /* east */ \
  |  |  |  |  |  |  327|   155k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   155k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   155k| \
  |  |  |  |  |  |  329|   155k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   155k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   155k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   155k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   155k| \
  |  |  |  |  |  |  332|   155k|    /* west */ \
  |  |  |  |  |  |  333|   155k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   155k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   155k| \
  |  |  |  |  |  |  335|   155k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   155k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   155k| \
  |  |  |  |  |  |  343|   155k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   155k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   155k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   155k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   155k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   155k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   155k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   155k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   155k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   155k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   155k|    } \
  |  |  |  |  |  |  350|   155k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   155k|            } \
  |  |  |  | 1142|   155k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   404k|    } \
  |  |  |  | 1144|  2.03M|}
  |  |  ------------------
  |  | 1325|  2.03M|                                    flags, flagsp, flags_stride, data, \
  |  | 1326|  2.03M|                                    l_w, 3, mqc, curctx, \
  |  | 1327|  2.03M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1328|  2.03M|            } \
  |  | 1329|  2.53M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  2.06M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  2.06M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  2.06M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  2.06M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1330|  2.06M|        } \
  |  | 1331|  39.5k|    } \
  |  | 1332|  2.47k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  2.47k|        mqc->curctx = curctx; \
  |  |  |  |  167|  2.47k|        mqc->c = c; \
  |  |  |  |  168|  2.47k|        mqc->a = a; \
  |  |  |  |  169|  2.47k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1333|  2.47k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1333:9): [True: 0, False: 2.47k]
  |  |  ------------------
  |  | 1334|      0|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1334:21): [True: 0, False: 0]
  |  |  ------------------
  |  | 1335|      0|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1335:25): [True: 0, False: 0]
  |  |  ------------------
  |  | 1336|      0|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1337|      0|            } \
  |  | 1338|      0|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|      0|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|      0|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|      0|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1339|      0|        } \
  |  | 1340|      0|    } \
  |  | 1341|  2.47k|}
  ------------------
 1376|  2.47k|}
t1.c:opj_t1_dec_clnpass_step:
 1153|  1.01M|{
 1154|  1.01M|    OPJ_UINT32 v;
 1155|       |
 1156|  1.01M|    opj_mqc_t *mqc = &(t1->mqc);   /* MQC component */
 1157|  1.01M|    opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE,
  ------------------
  |  | 1121|  1.01M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  | 1122|  1.01M|{ \
  |  | 1123|  1.01M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  ------------------
  |  |  |  |  153|  1.01M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  1.01M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  ------------------
  |  |  |  |  163|  1.01M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  1.01M|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  Branch (1123:26): [True: 317k, False: 698k]
  |  |  ------------------
  |  | 1124|   317k|        do { \
  |  | 1125|   317k|            if( !partial ) { \
  |  |  ------------------
  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  ------------------
  |  | 1126|   317k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  | 1127|   317k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  ------------------
  |  |  |  |   65|   317k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1128|   317k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   317k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   317k|{ \
  |  |  |  |  140|   317k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   317k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   317k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   317k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   317k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   317k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 46.7k, False: 270k]
  |  |  |  |  ------------------
  |  |  |  |  146|  46.7k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  46.7k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  46.7k|{ \
  |  |  |  |  |  |   57|  46.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 9.07k, False: 37.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  9.07k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  9.07k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  9.07k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  37.6k|    } else { \
  |  |  |  |  |  |   62|  37.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  37.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  37.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  37.6k|    } \
  |  |  |  |  |  |   66|  46.7k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  46.7k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  46.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  46.7k|{ \
  |  |  |  |  |  |  128|  79.2k|    do { \
  |  |  |  |  |  |  129|  79.2k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 9.96k, False: 69.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  9.96k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  9.96k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  9.96k|{ \
  |  |  |  |  |  |  |  |  104|  9.96k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  9.96k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  9.96k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  9.96k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  9.96k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8.48k, False: 1.48k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  8.48k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.41k, False: 71]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  8.41k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  8.41k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  8.41k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  8.41k|            } else { \
  |  |  |  |  |  |  |  |  114|     71|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     71|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     71|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     71|            } \
  |  |  |  |  |  |  |  |  118|  8.48k|        } else { \
  |  |  |  |  |  |  |  |  119|  1.48k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  1.48k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  1.48k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  1.48k|        } \
  |  |  |  |  |  |  |  |  123|  9.96k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  9.96k|        } \
  |  |  |  |  |  |  132|  79.2k|        a <<= 1; \
  |  |  |  |  |  |  133|  79.2k|        c <<= 1; \
  |  |  |  |  |  |  134|  79.2k|        ct--; \
  |  |  |  |  |  |  135|  79.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 32.4k, False: 46.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  46.7k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   270k|    } else {  \
  |  |  |  |  149|   270k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   270k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 49.5k, False: 221k]
  |  |  |  |  ------------------
  |  |  |  |  151|  49.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  49.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  49.5k|{ \
  |  |  |  |  |  |   45|  49.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 7.30k, False: 42.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  7.30k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  7.30k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  42.2k|    } else { \
  |  |  |  |  |  |   49|  42.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  42.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  42.2k|    } \
  |  |  |  |  |  |   52|  49.5k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  49.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  49.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  49.5k|{ \
  |  |  |  |  |  |  128|  52.9k|    do { \
  |  |  |  |  |  |  129|  52.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 6.81k, False: 46.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  6.81k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  6.81k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  6.81k|{ \
  |  |  |  |  |  |  |  |  104|  6.81k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  6.81k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  6.81k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  6.81k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  6.81k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.20k, False: 616]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  6.20k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.16k, False: 39]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  6.16k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  6.16k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  6.16k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  6.16k|            } else { \
  |  |  |  |  |  |  |  |  114|     39|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     39|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     39|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     39|            } \
  |  |  |  |  |  |  |  |  118|  6.20k|        } else { \
  |  |  |  |  |  |  |  |  119|    616|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    616|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    616|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    616|        } \
  |  |  |  |  |  |  |  |  123|  6.81k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  6.81k|        } \
  |  |  |  |  |  |  132|  52.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  52.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  52.9k|        ct--; \
  |  |  |  |  |  |  135|  52.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 3.38k, False: 49.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  49.5k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   221k|        } else { \
  |  |  |  |  154|   221k|            d = (*curctx)->mps; \
  |  |  |  |  155|   221k|        } \
  |  |  |  |  156|   270k|    } \
  |  |  |  |  157|   317k|}
  |  |  ------------------
  |  | 1129|   317k|                if( !v ) \
  |  |  ------------------
  |  |  |  Branch (1129:21): [True: 240k, False: 76.8k]
  |  |  ------------------
  |  | 1130|   317k|                    break; \
  |  | 1131|   317k|            } \
  |  | 1132|   317k|            { \
  |  | 1133|  76.8k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  | 1134|  76.8k|                                    flags, flagsp[-1], flagsp[1], \
  |  | 1135|  76.8k|                                    ci); \
  |  | 1136|  76.8k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  ------------------
  |  |  |  |   65|  76.8k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1137|  76.8k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  76.8k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  76.8k|{ \
  |  |  |  |  140|  76.8k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  76.8k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  76.8k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  76.8k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  76.8k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  76.8k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 19.6k, False: 57.2k]
  |  |  |  |  ------------------
  |  |  |  |  146|  19.6k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  19.6k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  19.6k|{ \
  |  |  |  |  |  |   57|  19.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 4.53k, False: 15.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  4.53k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  4.53k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  4.53k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  15.1k|    } else { \
  |  |  |  |  |  |   62|  15.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  15.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  15.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  15.1k|    } \
  |  |  |  |  |  |   66|  19.6k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  19.6k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  19.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  19.6k|{ \
  |  |  |  |  |  |  128|  31.6k|    do { \
  |  |  |  |  |  |  129|  31.6k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 3.95k, False: 27.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  3.95k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  3.95k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  3.95k|{ \
  |  |  |  |  |  |  |  |  104|  3.95k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  3.95k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  3.95k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  3.95k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  3.95k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.42k, False: 522]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  3.42k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.41k, False: 17]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  3.41k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  3.41k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  3.41k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  3.41k|            } else { \
  |  |  |  |  |  |  |  |  114|     17|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     17|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     17|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     17|            } \
  |  |  |  |  |  |  |  |  118|  3.42k|        } else { \
  |  |  |  |  |  |  |  |  119|    522|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    522|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    522|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    522|        } \
  |  |  |  |  |  |  |  |  123|  3.95k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  3.95k|        } \
  |  |  |  |  |  |  132|  31.6k|        a <<= 1; \
  |  |  |  |  |  |  133|  31.6k|        c <<= 1; \
  |  |  |  |  |  |  134|  31.6k|        ct--; \
  |  |  |  |  |  |  135|  31.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 11.9k, False: 19.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  19.6k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  57.2k|    } else {  \
  |  |  |  |  149|  57.2k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  57.2k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 20.3k, False: 36.8k]
  |  |  |  |  ------------------
  |  |  |  |  151|  20.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  20.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  20.3k|{ \
  |  |  |  |  |  |   45|  20.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 3.48k, False: 16.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  3.48k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  3.48k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  16.9k|    } else { \
  |  |  |  |  |  |   49|  16.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  16.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  16.9k|    } \
  |  |  |  |  |  |   52|  20.3k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  20.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  20.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  20.3k|{ \
  |  |  |  |  |  |  128|  21.9k|    do { \
  |  |  |  |  |  |  129|  21.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 2.71k, False: 19.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  2.71k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  2.71k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  2.71k|{ \
  |  |  |  |  |  |  |  |  104|  2.71k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  2.71k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  2.71k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  2.71k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  2.71k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.43k, False: 277]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  2.43k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.42k, False: 16]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  2.42k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  2.42k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  2.42k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  2.42k|            } else { \
  |  |  |  |  |  |  |  |  114|     16|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     16|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     16|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     16|            } \
  |  |  |  |  |  |  |  |  118|  2.43k|        } else { \
  |  |  |  |  |  |  |  |  119|    277|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    277|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    277|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    277|        } \
  |  |  |  |  |  |  |  |  123|  2.71k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  2.71k|        } \
  |  |  |  |  |  |  132|  21.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  21.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  21.9k|        ct--; \
  |  |  |  |  |  |  135|  21.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 1.55k, False: 20.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  20.3k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  36.8k|        } else { \
  |  |  |  |  154|  36.8k|            d = (*curctx)->mps; \
  |  |  |  |  155|  36.8k|        } \
  |  |  |  |  156|  57.2k|    } \
  |  |  |  |  157|  76.8k|}
  |  |  ------------------
  |  | 1138|  76.8k|                v = v ^ opj_t1_getspb(lu); \
  |  | 1139|  76.8k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  ------------------
  |  |  |  Branch (1139:40): [True: 40.6k, False: 36.1k]
  |  |  ------------------
  |  | 1140|  76.8k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  ------------------
  |  |  |  |  324|  76.8k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  325|  76.8k|{ \
  |  |  |  |  326|  76.8k|    /* east */ \
  |  |  |  |  327|  76.8k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  76.8k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  |  |  328|  76.8k| \
  |  |  |  |  329|  76.8k|    /* mark target as significant */ \
  |  |  |  |  330|  76.8k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  76.8k|#define T1_CHI_1_I  19
  |  |  |  |  ------------------
  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  76.8k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  |  |  331|  76.8k| \
  |  |  |  |  332|  76.8k|    /* west */ \
  |  |  |  |  333|  76.8k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  76.8k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  |  |  334|  76.8k| \
  |  |  |  |  335|  76.8k|    /* north-west, north, north-east */ \
  |  |  |  |  336|  76.8k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (336:9): [True: 37.5k, False: 39.3k]
  |  |  |  |  |  Branch (336:21): [True: 16.6k, False: 20.8k]
  |  |  |  |  ------------------
  |  |  |  |  337|  16.6k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  338|  16.6k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|  16.6k|#define T1_CHI_5_I  31
  |  |  |  |  ------------------
  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  16.6k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  ------------------
  |  |  |  |  339|  16.6k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  16.6k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  ------------------
  |  |  |  |  340|  16.6k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|  16.6k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  ------------------
  |  |  |  |  341|  16.6k|    } \
  |  |  |  |  342|  76.8k| \
  |  |  |  |  343|  76.8k|    /* south-west, south, south-east */ \
  |  |  |  |  344|  76.8k|    if (ci == 3U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:9): [True: 0, False: 76.8k]
  |  |  |  |  ------------------
  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  ------------------
  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  ------------------
  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  |  |  349|      0|    } \
  |  |  |  |  350|  76.8k|}
  |  |  ------------------
  |  | 1141|  76.8k|            } \
  |  | 1142|  76.8k|        } while(0); \
  |  |  ------------------
  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  ------------------
  |  | 1143|   317k|    } \
  |  | 1144|  1.01M|}
  ------------------
 1158|  1.01M|                                  *flagsp, flagsp, t1->w + 2U, datap,
 1159|  1.01M|                                  0, ci, mqc, mqc->curctx,
 1160|  1.01M|                                  v, mqc->a, mqc->c, mqc->ct, oneplushalf, vsc);
 1161|  1.01M|}
t1.c:opj_t1_dec_clnpass_64x64_novsc:
 1367|  6.38k|{
 1368|  6.38k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_FALSE, 64, 64, 66);
  ------------------
  |  | 1254|  6.38k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1255|  6.38k|{ \
  |  | 1256|  6.38k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1257|  6.38k|    OPJ_UINT32 runlen; \
  |  | 1258|  6.38k|    OPJ_UINT32 i, j, k; \
  |  | 1259|  6.38k|    const OPJ_UINT32 l_w = w; \
  |  | 1260|  6.38k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1261|  6.38k|    register OPJ_INT32 *data = t1->data; \
  |  | 1262|  6.38k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1263|  6.38k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  6.38k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  6.38k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  6.38k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  6.38k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1264|  6.38k|    register OPJ_UINT32 v; \
  |  | 1265|  6.38k|    one = 1 << bpno; \
  |  | 1266|  6.38k|    half = one >> 1; \
  |  | 1267|  6.38k|    oneplushalf = one | half; \
  |  | 1268|   108k|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 102k, False: 6.38k]
  |  |  ------------------
  |  | 1269|  6.63M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1269:21): [True: 6.53M, False: 102k]
  |  |  ------------------
  |  | 1270|  6.53M|            opj_flag_t flags = *flagsp; \
  |  | 1271|  6.53M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1271:17): [True: 3.68M, False: 2.85M]
  |  |  ------------------
  |  | 1272|  3.68M|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  3.68M|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1273|  3.68M|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   65|  3.68M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1274|  3.68M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  3.68M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  3.68M|{ \
  |  |  |  |  140|  3.68M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  3.68M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  3.68M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  3.68M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  3.68M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  3.68M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 84.3k, False: 3.59M]
  |  |  |  |  ------------------
  |  |  |  |  146|  84.3k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  84.3k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  84.3k|{ \
  |  |  |  |  |  |   57|  84.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 3.62k, False: 80.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  3.62k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  3.62k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  3.62k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  80.7k|    } else { \
  |  |  |  |  |  |   62|  80.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  80.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  80.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  80.7k|    } \
  |  |  |  |  |  |   66|  84.3k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  84.3k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  84.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  84.3k|{ \
  |  |  |  |  |  |  128|   288k|    do { \
  |  |  |  |  |  |  129|   288k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 35.8k, False: 252k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  35.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  35.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  35.8k|{ \
  |  |  |  |  |  |  |  |  104|  35.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  35.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  35.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  35.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  35.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.06k, False: 33.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  2.06k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.63k, False: 431]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.63k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.63k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.63k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.63k|            } else { \
  |  |  |  |  |  |  |  |  114|    431|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    431|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    431|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    431|            } \
  |  |  |  |  |  |  |  |  118|  33.8k|        } else { \
  |  |  |  |  |  |  |  |  119|  33.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  33.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  33.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  33.8k|        } \
  |  |  |  |  |  |  |  |  123|  35.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  35.8k|        } \
  |  |  |  |  |  |  132|   288k|        a <<= 1; \
  |  |  |  |  |  |  133|   288k|        c <<= 1; \
  |  |  |  |  |  |  134|   288k|        ct--; \
  |  |  |  |  |  |  135|   288k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 204k, False: 84.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  84.3k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  3.59M|    } else {  \
  |  |  |  |  149|  3.59M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  3.59M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 134k, False: 3.46M]
  |  |  |  |  ------------------
  |  |  |  |  151|   134k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   134k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   134k|{ \
  |  |  |  |  |  |   45|   134k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 2.52k, False: 131k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  2.52k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  2.52k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   131k|    } else { \
  |  |  |  |  |  |   49|   131k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   131k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   131k|    } \
  |  |  |  |  |  |   52|   134k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   134k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   134k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   134k|{ \
  |  |  |  |  |  |  128|   135k|    do { \
  |  |  |  |  |  |  129|   135k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 17.3k, False: 118k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  17.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  17.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  17.3k|{ \
  |  |  |  |  |  |  |  |  104|  17.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  17.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  17.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  17.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  17.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.40k, False: 15.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  1.40k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.12k, False: 286]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.12k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.12k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.12k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.12k|            } else { \
  |  |  |  |  |  |  |  |  114|    286|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    286|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    286|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    286|            } \
  |  |  |  |  |  |  |  |  118|  15.9k|        } else { \
  |  |  |  |  |  |  |  |  119|  15.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  15.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  15.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  15.9k|        } \
  |  |  |  |  |  |  |  |  123|  17.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  17.3k|        } \
  |  |  |  |  |  |  132|   135k|        a <<= 1; \
  |  |  |  |  |  |  133|   135k|        c <<= 1; \
  |  |  |  |  |  |  134|   135k|        ct--; \
  |  |  |  |  |  |  135|   135k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 1.19k, False: 134k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   134k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  3.46M|        } else { \
  |  |  |  |  154|  3.46M|            d = (*curctx)->mps; \
  |  |  |  |  155|  3.46M|        } \
  |  |  |  |  156|  3.59M|    } \
  |  |  |  |  157|  3.68M|}
  |  |  ------------------
  |  | 1275|  3.68M|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1275:21): [True: 3.59M, False: 89.0k]
  |  |  ------------------
  |  | 1276|  3.59M|                    continue; \
  |  | 1277|  3.59M|                } \
  |  | 1278|  3.68M|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   65|  89.0k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1279|  89.0k|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  89.0k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  89.0k|{ \
  |  |  |  |  140|  89.0k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  89.0k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  89.0k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  89.0k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  89.0k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  89.0k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 43.8k, False: 45.2k]
  |  |  |  |  ------------------
  |  |  |  |  146|  43.8k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  43.8k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  43.8k|{ \
  |  |  |  |  |  |   57|  43.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 29.0k, False: 14.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  29.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  29.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  29.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  29.0k|    } else { \
  |  |  |  |  |  |   62|  14.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  14.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  14.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  14.7k|    } \
  |  |  |  |  |  |   66|  43.8k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  43.8k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  43.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  43.8k|{ \
  |  |  |  |  |  |  128|  43.8k|    do { \
  |  |  |  |  |  |  129|  43.8k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 5.25k, False: 38.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  5.25k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  5.25k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  5.25k|{ \
  |  |  |  |  |  |  |  |  104|  5.25k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  5.25k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  5.25k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  5.25k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  5.25k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 712, False: 4.54k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    712|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 591, False: 121]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    591|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    591|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    591|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    591|            } else { \
  |  |  |  |  |  |  |  |  114|    121|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    121|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    121|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    121|            } \
  |  |  |  |  |  |  |  |  118|  4.54k|        } else { \
  |  |  |  |  |  |  |  |  119|  4.54k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  4.54k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  4.54k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  4.54k|        } \
  |  |  |  |  |  |  |  |  123|  5.25k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  5.25k|        } \
  |  |  |  |  |  |  132|  43.8k|        a <<= 1; \
  |  |  |  |  |  |  133|  43.8k|        c <<= 1; \
  |  |  |  |  |  |  134|  43.8k|        ct--; \
  |  |  |  |  |  |  135|  43.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 43.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  43.8k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  45.2k|    } else {  \
  |  |  |  |  149|  45.2k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  45.2k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 40.4k, False: 4.82k]
  |  |  |  |  ------------------
  |  |  |  |  151|  40.4k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  40.4k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  40.4k|{ \
  |  |  |  |  |  |   45|  40.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 27.9k, False: 12.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  27.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  27.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  27.9k|    } else { \
  |  |  |  |  |  |   49|  12.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  12.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  12.4k|    } \
  |  |  |  |  |  |   52|  40.4k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  40.4k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  40.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  40.4k|{ \
  |  |  |  |  |  |  128|  55.9k|    do { \
  |  |  |  |  |  |  129|  55.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 7.13k, False: 48.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  7.13k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  7.13k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  7.13k|{ \
  |  |  |  |  |  |  |  |  104|  7.13k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  7.13k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  7.13k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  7.13k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  7.13k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 757, False: 6.37k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    757|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 597, False: 160]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    597|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    597|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    597|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    597|            } else { \
  |  |  |  |  |  |  |  |  114|    160|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    160|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    160|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    160|            } \
  |  |  |  |  |  |  |  |  118|  6.37k|        } else { \
  |  |  |  |  |  |  |  |  119|  6.37k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  6.37k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  6.37k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  6.37k|        } \
  |  |  |  |  |  |  |  |  123|  7.13k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  7.13k|        } \
  |  |  |  |  |  |  132|  55.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  55.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  55.9k|        ct--; \
  |  |  |  |  |  |  135|  55.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 15.5k, False: 40.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  40.4k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  40.4k|        } else { \
  |  |  |  |  154|  4.82k|            d = (*curctx)->mps; \
  |  |  |  |  155|  4.82k|        } \
  |  |  |  |  156|  45.2k|    } \
  |  |  |  |  157|  89.0k|}
  |  |  ------------------
  |  | 1280|  89.0k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  89.0k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  89.0k|{ \
  |  |  |  |  140|  89.0k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  89.0k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  89.0k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  89.0k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  89.0k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  89.0k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 42.9k, False: 46.1k]
  |  |  |  |  ------------------
  |  |  |  |  146|  42.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  42.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  42.9k|{ \
  |  |  |  |  |  |   57|  42.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 8.16k, False: 34.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  8.16k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  8.16k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  8.16k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  34.7k|    } else { \
  |  |  |  |  |  |   62|  34.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  34.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  34.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  34.7k|    } \
  |  |  |  |  |  |   66|  42.9k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  42.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  42.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  42.9k|{ \
  |  |  |  |  |  |  128|  42.9k|    do { \
  |  |  |  |  |  |  129|  42.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 5.37k, False: 37.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  5.37k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  5.37k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  5.37k|{ \
  |  |  |  |  |  |  |  |  104|  5.37k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  5.37k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  5.37k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  5.37k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  5.37k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 710, False: 4.66k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    710|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 538, False: 172]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    538|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    538|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    538|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    538|            } else { \
  |  |  |  |  |  |  |  |  114|    172|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    172|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    172|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    172|            } \
  |  |  |  |  |  |  |  |  118|  4.66k|        } else { \
  |  |  |  |  |  |  |  |  119|  4.66k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  4.66k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  4.66k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  4.66k|        } \
  |  |  |  |  |  |  |  |  123|  5.37k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  5.37k|        } \
  |  |  |  |  |  |  132|  42.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  42.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  42.9k|        ct--; \
  |  |  |  |  |  |  135|  42.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 42.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  42.9k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  46.1k|    } else {  \
  |  |  |  |  149|  46.1k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  46.1k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 41.3k, False: 4.73k]
  |  |  |  |  ------------------
  |  |  |  |  151|  41.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  41.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  41.3k|{ \
  |  |  |  |  |  |   45|  41.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 9.12k, False: 32.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  9.12k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  9.12k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  32.2k|    } else { \
  |  |  |  |  |  |   49|  32.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  32.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  32.2k|    } \
  |  |  |  |  |  |   52|  41.3k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  41.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  41.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  41.3k|{ \
  |  |  |  |  |  |  128|  47.0k|    do { \
  |  |  |  |  |  |  129|  47.0k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 5.72k, False: 41.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  5.72k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  5.72k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  5.72k|{ \
  |  |  |  |  |  |  |  |  104|  5.72k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  5.72k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  5.72k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  5.72k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  5.72k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 733, False: 4.99k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    733|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 587, False: 146]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    587|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    587|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    587|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    587|            } else { \
  |  |  |  |  |  |  |  |  114|    146|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    146|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    146|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    146|            } \
  |  |  |  |  |  |  |  |  118|  4.99k|        } else { \
  |  |  |  |  |  |  |  |  119|  4.99k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  4.99k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  4.99k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  4.99k|        } \
  |  |  |  |  |  |  |  |  123|  5.72k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  5.72k|        } \
  |  |  |  |  |  |  132|  47.0k|        a <<= 1; \
  |  |  |  |  |  |  133|  47.0k|        c <<= 1; \
  |  |  |  |  |  |  134|  47.0k|        ct--; \
  |  |  |  |  |  |  135|  47.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 5.63k, False: 41.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  41.3k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  41.3k|        } else { \
  |  |  |  |  154|  4.73k|            d = (*curctx)->mps; \
  |  |  |  |  155|  4.73k|        } \
  |  |  |  |  156|  46.1k|    } \
  |  |  |  |  157|  89.0k|}
  |  |  ------------------
  |  | 1281|  89.0k|                runlen = (runlen << 1) | v; \
  |  | 1282|  89.0k|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1282:24): [True: 0, False: 89.0k]
  |  |  ------------------
  |  | 1283|  26.7k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1283:21): [True: 26.7k, False: 62.2k]
  |  |  ------------------
  |  | 1284|  26.7k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1121|  26.7k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  26.7k|{ \
  |  |  |  | 1123|  26.7k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  26.7k|        do { \
  |  |  |  | 1125|  26.7k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|      0|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|      0|{ \
  |  |  |  |  |  |  140|      0|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|      0|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|      0|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|      0|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|      0|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|      0|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|      0|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|      0|{ \
  |  |  |  |  |  |  |  |   57|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|      0|    } else { \
  |  |  |  |  |  |  |  |   62|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|      0|    } \
  |  |  |  |  |  |  |  |   66|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|      0|    } else {  \
  |  |  |  |  |  |  149|      0|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|      0|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|      0|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|      0|{ \
  |  |  |  |  |  |  |  |   45|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|      0|    } else { \
  |  |  |  |  |  |  |  |   49|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|      0|    } \
  |  |  |  |  |  |  |  |   52|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|        } else { \
  |  |  |  |  |  |  154|      0|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      0|        } \
  |  |  |  |  |  |  156|      0|    } \
  |  |  |  |  |  |  157|      0|}
  |  |  |  |  ------------------
  |  |  |  | 1129|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1130|      0|                    break; \
  |  |  |  | 1131|      0|            } \
  |  |  |  | 1132|  26.7k|            { \
  |  |  |  | 1133|  26.7k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  26.7k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  26.7k|                                    ci); \
  |  |  |  | 1136|  26.7k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  26.7k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  26.7k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  26.7k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  26.7k|{ \
  |  |  |  |  |  |  140|  26.7k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  26.7k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  26.7k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  26.7k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  26.7k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  26.7k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 10.3k, False: 16.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  10.3k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  10.3k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  10.3k|{ \
  |  |  |  |  |  |  |  |   57|  10.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 286, False: 10.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    286|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    286|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    286|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  10.0k|    } else { \
  |  |  |  |  |  |  |  |   62|  10.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  10.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  10.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  10.0k|    } \
  |  |  |  |  |  |  |  |   66|  10.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  10.3k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  10.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  10.3k|{ \
  |  |  |  |  |  |  |  |  128|  15.5k|    do { \
  |  |  |  |  |  |  |  |  129|  15.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.85k, False: 13.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.85k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.85k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.85k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.85k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.85k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.85k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.85k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.85k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 205, False: 1.64k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    205|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 165, False: 40]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    165|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    165|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    165|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    165|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     40|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     40|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     40|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     40|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.64k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.64k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.64k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.64k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.64k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.85k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.85k|        } \
  |  |  |  |  |  |  |  |  132|  15.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  15.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  15.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  15.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.17k, False: 10.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  10.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  16.4k|    } else {  \
  |  |  |  |  |  |  149|  16.4k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  16.4k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 10.2k, False: 6.19k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  10.2k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  10.2k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  10.2k|{ \
  |  |  |  |  |  |  |  |   45|  10.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 234, False: 10.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    234|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    234|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  10.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  10.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  10.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  10.0k|    } \
  |  |  |  |  |  |  |  |   52|  10.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.2k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  10.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  10.2k|{ \
  |  |  |  |  |  |  |  |  128|  10.2k|    do { \
  |  |  |  |  |  |  |  |  129|  10.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.33k, False: 8.93k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.33k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.33k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.33k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.33k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.33k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.33k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.33k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.33k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 176, False: 1.15k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    176|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 134, False: 42]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    134|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    134|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    134|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    134|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     42|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     42|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     42|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     42|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.15k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.15k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.15k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.15k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.15k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.33k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.33k|        } \
  |  |  |  |  |  |  |  |  132|  10.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  10.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  10.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  10.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 31, False: 10.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  10.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  10.2k|        } else { \
  |  |  |  |  |  |  154|  6.19k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  6.19k|        } \
  |  |  |  |  |  |  156|  16.4k|    } \
  |  |  |  |  |  |  157|  26.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  26.7k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  26.7k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 11.2k, False: 15.5k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  26.7k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  26.7k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  26.7k|{ \
  |  |  |  |  |  |  326|  26.7k|    /* east */ \
  |  |  |  |  |  |  327|  26.7k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  26.7k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  26.7k| \
  |  |  |  |  |  |  329|  26.7k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  26.7k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  26.7k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  26.7k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  26.7k| \
  |  |  |  |  |  |  332|  26.7k|    /* west */ \
  |  |  |  |  |  |  333|  26.7k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  26.7k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  26.7k| \
  |  |  |  |  |  |  335|  26.7k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  26.7k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|  26.7k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|  26.7k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|  26.7k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|  26.7k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|  26.7k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|  26.7k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|  26.7k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|  26.7k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|  26.7k|    } \
  |  |  |  |  |  |  342|  26.7k| \
  |  |  |  |  |  |  343|  26.7k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  26.7k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  26.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  26.7k|            } \
  |  |  |  | 1142|  26.7k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  26.7k|    } \
  |  |  |  | 1144|  26.7k|}
  |  |  ------------------
  |  | 1285|  26.7k|                                            flags, flagsp, flags_stride, data, \
  |  | 1286|  26.7k|                                            l_w, 0, mqc, curctx, \
  |  | 1287|  26.7k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1288|  26.7k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  26.7k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1289|  26.7k|                        /* FALLTHRU */ \
  |  | 1290|  46.3k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1290:21): [True: 19.5k, False: 69.4k]
  |  |  ------------------
  |  | 1291|  46.3k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  46.3k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  46.3k|{ \
  |  |  |  | 1123|  46.3k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  46.3k|        do { \
  |  |  |  | 1125|  46.3k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 26.7k, False: 19.5k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  26.7k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  26.7k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  26.7k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  26.7k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  26.7k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  26.7k|{ \
  |  |  |  |  |  |  140|  26.7k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  26.7k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  26.7k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  26.7k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  26.7k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  26.7k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 5.13k, False: 21.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  5.13k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  5.13k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  5.13k|{ \
  |  |  |  |  |  |  |  |   57|  5.13k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 765, False: 4.37k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    765|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    765|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    765|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  4.37k|    } else { \
  |  |  |  |  |  |  |  |   62|  4.37k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  4.37k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  4.37k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  4.37k|    } \
  |  |  |  |  |  |  |  |   66|  5.13k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  5.13k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  5.13k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  5.13k|{ \
  |  |  |  |  |  |  |  |  128|  9.24k|    do { \
  |  |  |  |  |  |  |  |  129|  9.24k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.17k, False: 8.07k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.17k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.17k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.17k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.17k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.17k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.17k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.17k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.17k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 165, False: 1.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    165|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 128, False: 37]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    128|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    128|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    128|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    128|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     37|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     37|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     37|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     37|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.00k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.00k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.00k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.00k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.00k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.17k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.17k|        } \
  |  |  |  |  |  |  |  |  132|  9.24k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.24k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.24k|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.24k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.11k, False: 5.13k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  5.13k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  21.6k|    } else {  \
  |  |  |  |  |  |  149|  21.6k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  21.6k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 7.47k, False: 14.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  7.47k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  7.47k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  7.47k|{ \
  |  |  |  |  |  |  |  |   45|  7.47k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 447, False: 7.02k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    447|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    447|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.02k|    } else { \
  |  |  |  |  |  |  |  |   49|  7.02k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.02k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.02k|    } \
  |  |  |  |  |  |  |  |   52|  7.47k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  7.47k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  7.47k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  7.47k|{ \
  |  |  |  |  |  |  |  |  128|  7.71k|    do { \
  |  |  |  |  |  |  |  |  129|  7.71k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 960, False: 6.75k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    960|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    960|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    960|{ \
  |  |  |  |  |  |  |  |  |  |  104|    960|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    960|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    960|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    960|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    960|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 104, False: 856]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    104|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 76, False: 28]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     76|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     76|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     76|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     76|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     28|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     28|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     28|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     28|            } \
  |  |  |  |  |  |  |  |  |  |  118|    856|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    856|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    856|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    856|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    856|        } \
  |  |  |  |  |  |  |  |  |  |  123|    960|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    960|        } \
  |  |  |  |  |  |  |  |  132|  7.71k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  7.71k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  7.71k|        ct--; \
  |  |  |  |  |  |  |  |  135|  7.71k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 245, False: 7.47k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  7.47k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  14.1k|        } else { \
  |  |  |  |  |  |  154|  14.1k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  14.1k|        } \
  |  |  |  |  |  |  156|  21.6k|    } \
  |  |  |  |  |  |  157|  26.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  26.7k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 21.7k, False: 5.03k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  26.7k|                    break; \
  |  |  |  | 1131|  26.7k|            } \
  |  |  |  | 1132|  46.3k|            { \
  |  |  |  | 1133|  24.5k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  24.5k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  24.5k|                                    ci); \
  |  |  |  | 1136|  24.5k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  24.5k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  24.5k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  24.5k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  24.5k|{ \
  |  |  |  |  |  |  140|  24.5k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  24.5k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  24.5k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  24.5k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  24.5k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  24.5k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.09k, False: 16.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.09k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.09k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.09k|{ \
  |  |  |  |  |  |  |  |   57|  8.09k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 256, False: 7.83k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    256|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    256|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    256|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  7.83k|    } else { \
  |  |  |  |  |  |  |  |   62|  7.83k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  7.83k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  7.83k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  7.83k|    } \
  |  |  |  |  |  |  |  |   66|  8.09k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.09k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.09k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.09k|{ \
  |  |  |  |  |  |  |  |  128|  12.1k|    do { \
  |  |  |  |  |  |  |  |  129|  12.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.54k, False: 10.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.54k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.54k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.54k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.54k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.54k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.54k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.54k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.54k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 259, False: 1.28k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    259|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 183, False: 76]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    183|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    183|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    183|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    183|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     76|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     76|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     76|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     76|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.28k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.28k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.28k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.28k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.28k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.54k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.54k|        } \
  |  |  |  |  |  |  |  |  132|  12.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  12.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  12.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  12.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.09k, False: 8.09k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.09k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  16.4k|    } else {  \
  |  |  |  |  |  |  149|  16.4k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  16.4k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.49k, False: 6.99k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.49k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.49k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.49k|{ \
  |  |  |  |  |  |  |  |   45|  9.49k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 247, False: 9.24k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    247|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    247|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  9.24k|    } else { \
  |  |  |  |  |  |  |  |   49|  9.24k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  9.24k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  9.24k|    } \
  |  |  |  |  |  |  |  |   52|  9.49k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.49k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.49k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.49k|{ \
  |  |  |  |  |  |  |  |  128|  9.63k|    do { \
  |  |  |  |  |  |  |  |  129|  9.63k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.21k, False: 8.41k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.21k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.21k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.21k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.21k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.21k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.21k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.21k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.21k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 184, False: 1.03k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    184|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 146, False: 38]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    146|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    146|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    146|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    146|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     38|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     38|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     38|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     38|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.03k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.03k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.03k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.03k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.03k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.21k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.21k|        } \
  |  |  |  |  |  |  |  |  132|  9.63k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.63k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.63k|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.63k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 139, False: 9.49k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.49k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  9.49k|        } else { \
  |  |  |  |  |  |  154|  6.99k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  6.99k|        } \
  |  |  |  |  |  |  156|  16.4k|    } \
  |  |  |  |  |  |  157|  24.5k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  24.5k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  24.5k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 10.2k, False: 14.3k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  24.5k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  24.5k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  24.5k|{ \
  |  |  |  |  |  |  326|  24.5k|    /* east */ \
  |  |  |  |  |  |  327|  24.5k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  24.5k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  24.5k| \
  |  |  |  |  |  |  329|  24.5k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  24.5k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  24.5k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  24.5k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  24.5k| \
  |  |  |  |  |  |  332|  24.5k|    /* west */ \
  |  |  |  |  |  |  333|  24.5k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  24.5k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  24.5k| \
  |  |  |  |  |  |  335|  24.5k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  24.5k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  24.5k| \
  |  |  |  |  |  |  343|  24.5k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  24.5k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  24.5k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  24.5k|            } \
  |  |  |  | 1142|  24.5k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  46.3k|    } \
  |  |  |  | 1144|  46.3k|}
  |  |  ------------------
  |  | 1292|  46.3k|                                            flags, flagsp, flags_stride, data, \
  |  | 1293|  46.3k|                                            l_w, 1, mqc, curctx, \
  |  | 1294|  46.3k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1295|  46.3k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  46.3k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1296|  46.3k|                        /* FALLTHRU */ \
  |  | 1297|  64.7k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1297:21): [True: 18.3k, False: 70.6k]
  |  |  ------------------
  |  | 1298|  64.7k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  64.7k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  64.7k|{ \
  |  |  |  | 1123|  64.7k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  64.7k|        do { \
  |  |  |  | 1125|  64.7k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 46.3k, False: 18.3k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  46.3k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  46.3k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  46.3k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  46.3k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  46.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  46.3k|{ \
  |  |  |  |  |  |  140|  46.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  46.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  46.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  46.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  46.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  46.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.23k, False: 38.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.23k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.23k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.23k|{ \
  |  |  |  |  |  |  |  |   57|  8.23k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.06k, False: 7.17k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.06k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.06k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.06k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  7.17k|    } else { \
  |  |  |  |  |  |  |  |   62|  7.17k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  7.17k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  7.17k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  7.17k|    } \
  |  |  |  |  |  |  |  |   66|  8.23k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.23k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.23k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.23k|{ \
  |  |  |  |  |  |  |  |  128|  17.9k|    do { \
  |  |  |  |  |  |  |  |  129|  17.9k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.27k, False: 15.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.27k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.27k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.27k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.27k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.27k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.27k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.27k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.27k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 239, False: 2.03k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    239|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 176, False: 63]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    176|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    176|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    176|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    176|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     63|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     63|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     63|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     63|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.03k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.03k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.03k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.03k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.03k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.27k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.27k|        } \
  |  |  |  |  |  |  |  |  132|  17.9k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  17.9k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  17.9k|        ct--; \
  |  |  |  |  |  |  |  |  135|  17.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9.67k, False: 8.23k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.23k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  38.0k|    } else {  \
  |  |  |  |  |  |  149|  38.0k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  38.0k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 8.65k, False: 29.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  8.65k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  8.65k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  8.65k|{ \
  |  |  |  |  |  |  |  |   45|  8.65k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 665, False: 7.98k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    665|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    665|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.98k|    } else { \
  |  |  |  |  |  |  |  |   49|  7.98k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.98k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.98k|    } \
  |  |  |  |  |  |  |  |   52|  8.65k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.65k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.65k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.65k|{ \
  |  |  |  |  |  |  |  |  128|  9.02k|    do { \
  |  |  |  |  |  |  |  |  129|  9.02k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.13k, False: 7.88k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.13k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.13k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.13k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.13k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.13k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.13k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.13k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.13k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 216, False: 922]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    216|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 116, False: 100]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    116|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    116|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    116|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    116|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    100|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    100|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    100|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    100|            } \
  |  |  |  |  |  |  |  |  |  |  118|    922|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    922|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    922|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    922|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    922|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.13k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.13k|        } \
  |  |  |  |  |  |  |  |  132|  9.02k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.02k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.02k|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.02k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 370, False: 8.65k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.65k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  29.4k|        } else { \
  |  |  |  |  |  |  154|  29.4k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  29.4k|        } \
  |  |  |  |  |  |  156|  38.0k|    } \
  |  |  |  |  |  |  157|  46.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  46.3k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 37.9k, False: 8.38k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  46.3k|                    break; \
  |  |  |  | 1131|  46.3k|            } \
  |  |  |  | 1132|  64.7k|            { \
  |  |  |  | 1133|  26.7k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  26.7k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  26.7k|                                    ci); \
  |  |  |  | 1136|  26.7k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  26.7k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  26.7k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  26.7k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  26.7k|{ \
  |  |  |  |  |  |  140|  26.7k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  26.7k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  26.7k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  26.7k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  26.7k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  26.7k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.97k, False: 17.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.97k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.97k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.97k|{ \
  |  |  |  |  |  |  |  |   57|  8.97k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 994, False: 7.98k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    994|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    994|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    994|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  7.98k|    } else { \
  |  |  |  |  |  |  |  |   62|  7.98k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  7.98k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  7.98k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  7.98k|    } \
  |  |  |  |  |  |  |  |   66|  8.97k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.97k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.97k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.97k|{ \
  |  |  |  |  |  |  |  |  128|  13.8k|    do { \
  |  |  |  |  |  |  |  |  129|  13.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.58k, False: 12.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.58k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.58k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.58k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.58k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.58k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.58k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.58k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.58k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 226, False: 1.35k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    226|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 179, False: 47]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    179|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    179|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    179|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    179|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     47|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     47|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     47|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     47|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.35k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.35k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.35k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.35k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.35k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.58k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.58k|        } \
  |  |  |  |  |  |  |  |  132|  13.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  13.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  13.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  13.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.85k, False: 8.97k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.97k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  17.7k|    } else {  \
  |  |  |  |  |  |  149|  17.7k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  17.7k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.50k, False: 8.27k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.50k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.50k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.50k|{ \
  |  |  |  |  |  |  |  |   45|  9.50k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 808, False: 8.70k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    808|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    808|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  8.70k|    } else { \
  |  |  |  |  |  |  |  |   49|  8.70k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  8.70k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  8.70k|    } \
  |  |  |  |  |  |  |  |   52|  9.50k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.50k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.50k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.50k|{ \
  |  |  |  |  |  |  |  |  128|  9.92k|    do { \
  |  |  |  |  |  |  |  |  129|  9.92k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.24k, False: 8.67k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.24k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.24k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.24k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.24k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.24k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.24k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.24k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.24k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 194, False: 1.05k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    194|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 155, False: 39]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    155|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    155|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    155|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    155|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     39|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     39|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     39|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     39|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.05k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.05k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.05k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.05k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.05k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.24k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.24k|        } \
  |  |  |  |  |  |  |  |  132|  9.92k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.92k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.92k|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.92k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 412, False: 9.50k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.50k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  9.50k|        } else { \
  |  |  |  |  |  |  154|  8.27k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  8.27k|        } \
  |  |  |  |  |  |  156|  17.7k|    } \
  |  |  |  |  |  |  157|  26.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  26.7k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  26.7k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 11.2k, False: 15.5k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  26.7k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  26.7k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  26.7k|{ \
  |  |  |  |  |  |  326|  26.7k|    /* east */ \
  |  |  |  |  |  |  327|  26.7k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  26.7k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  26.7k| \
  |  |  |  |  |  |  329|  26.7k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  26.7k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  26.7k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  26.7k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  26.7k| \
  |  |  |  |  |  |  332|  26.7k|    /* west */ \
  |  |  |  |  |  |  333|  26.7k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  26.7k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  26.7k| \
  |  |  |  |  |  |  335|  26.7k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  26.7k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  26.7k| \
  |  |  |  |  |  |  343|  26.7k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  26.7k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  26.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  26.7k|            } \
  |  |  |  | 1142|  26.7k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  64.7k|    } \
  |  |  |  | 1144|  64.7k|}
  |  |  ------------------
  |  | 1299|  64.7k|                                            flags, flagsp, flags_stride, data, \
  |  | 1300|  64.7k|                                            l_w, 2, mqc, curctx, \
  |  | 1301|  64.7k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1302|  64.7k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  64.7k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1303|  64.7k|                        /* FALLTHRU */ \
  |  | 1304|  89.0k|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1304:21): [True: 24.3k, False: 64.7k]
  |  |  ------------------
  |  | 1305|  89.0k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  89.0k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  89.0k|{ \
  |  |  |  | 1123|  89.0k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  89.0k|        do { \
  |  |  |  | 1125|  89.0k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 64.7k, False: 24.3k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  64.7k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  64.7k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  64.7k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  64.7k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  64.7k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  64.7k|{ \
  |  |  |  |  |  |  140|  64.7k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  64.7k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  64.7k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  64.7k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  64.7k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  64.7k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.69k, False: 56.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.69k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.69k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.69k|{ \
  |  |  |  |  |  |  |  |   57|  8.69k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.16k, False: 7.52k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.16k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.16k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.16k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  7.52k|    } else { \
  |  |  |  |  |  |  |  |   62|  7.52k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  7.52k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  7.52k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  7.52k|    } \
  |  |  |  |  |  |  |  |   66|  8.69k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.69k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.69k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.69k|{ \
  |  |  |  |  |  |  |  |  128|  20.3k|    do { \
  |  |  |  |  |  |  |  |  129|  20.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.61k, False: 17.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.61k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.61k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.61k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.61k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.61k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.61k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.61k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.61k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 243, False: 2.37k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    243|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 205, False: 38]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    205|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    205|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    205|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    205|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     38|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     38|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     38|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     38|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.37k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.37k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.37k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.37k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.37k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.61k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.61k|        } \
  |  |  |  |  |  |  |  |  132|  20.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  20.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  20.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  20.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.6k, False: 8.69k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.69k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  56.0k|    } else {  \
  |  |  |  |  |  |  149|  56.0k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  56.0k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 11.0k, False: 44.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  11.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  11.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  11.0k|{ \
  |  |  |  |  |  |  |  |   45|  11.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 844, False: 10.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    844|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    844|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  10.2k|    } else { \
  |  |  |  |  |  |  |  |   49|  10.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  10.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  10.2k|    } \
  |  |  |  |  |  |  |  |   52|  11.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  11.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  11.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  11.0k|{ \
  |  |  |  |  |  |  |  |  128|  11.5k|    do { \
  |  |  |  |  |  |  |  |  129|  11.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.50k, False: 10.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.50k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.50k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.50k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.50k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.50k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.50k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.50k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.50k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 185, False: 1.31k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    185|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 147, False: 38]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    147|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    147|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    147|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    147|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     38|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     38|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     38|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     38|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.31k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.31k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.31k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.31k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.31k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.50k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.50k|        } \
  |  |  |  |  |  |  |  |  132|  11.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  11.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  11.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  11.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 440, False: 11.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  11.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  44.9k|        } else { \
  |  |  |  |  |  |  154|  44.9k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  44.9k|        } \
  |  |  |  |  |  |  156|  56.0k|    } \
  |  |  |  |  |  |  157|  64.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  64.7k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 55.7k, False: 8.97k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  64.7k|                    break; \
  |  |  |  | 1131|  64.7k|            } \
  |  |  |  | 1132|  89.0k|            { \
  |  |  |  | 1133|  33.3k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  33.3k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  33.3k|                                    ci); \
  |  |  |  | 1136|  33.3k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  33.3k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  33.3k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  33.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  33.3k|{ \
  |  |  |  |  |  |  140|  33.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  33.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  33.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  33.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  33.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  33.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 12.2k, False: 21.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  12.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  12.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  12.2k|{ \
  |  |  |  |  |  |  |  |   57|  12.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.39k, False: 10.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.39k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.39k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.39k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  10.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  10.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  10.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  10.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  10.8k|    } \
  |  |  |  |  |  |  |  |   66|  12.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  12.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  12.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  12.2k|{ \
  |  |  |  |  |  |  |  |  128|  18.8k|    do { \
  |  |  |  |  |  |  |  |  129|  18.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.41k, False: 16.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.41k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.41k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.41k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.41k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.41k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.41k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.41k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.41k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 239, False: 2.17k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    239|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 193, False: 46]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    193|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    193|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    193|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    193|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     46|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     46|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     46|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     46|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.17k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.17k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.17k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.17k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.17k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.41k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.41k|        } \
  |  |  |  |  |  |  |  |  132|  18.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  18.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  18.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  18.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.63k, False: 12.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  12.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  21.1k|    } else {  \
  |  |  |  |  |  |  149|  21.1k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  21.1k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 12.1k, False: 8.97k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  12.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  12.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  12.1k|{ \
  |  |  |  |  |  |  |  |   45|  12.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.13k, False: 11.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.13k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.13k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  11.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  11.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  11.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  11.0k|    } \
  |  |  |  |  |  |  |  |   52|  12.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  12.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  12.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  12.1k|{ \
  |  |  |  |  |  |  |  |  128|  12.7k|    do { \
  |  |  |  |  |  |  |  |  129|  12.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.67k, False: 11.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.67k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.67k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.67k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.67k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.67k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.67k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.67k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.67k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 193, False: 1.48k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    193|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 153, False: 40]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    153|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    153|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    153|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    153|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     40|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     40|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     40|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     40|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.48k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.48k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.48k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.48k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.48k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.67k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.67k|        } \
  |  |  |  |  |  |  |  |  132|  12.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  12.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  12.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  12.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 604, False: 12.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  12.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  12.1k|        } else { \
  |  |  |  |  |  |  154|  8.97k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  8.97k|        } \
  |  |  |  |  |  |  156|  21.1k|    } \
  |  |  |  |  |  |  157|  33.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  33.3k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  33.3k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 13.8k, False: 19.4k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  33.3k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  33.3k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  33.3k|{ \
  |  |  |  |  |  |  326|  33.3k|    /* east */ \
  |  |  |  |  |  |  327|  33.3k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  33.3k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  33.3k| \
  |  |  |  |  |  |  329|  33.3k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  33.3k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  33.3k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  33.3k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  33.3k| \
  |  |  |  |  |  |  332|  33.3k|    /* west */ \
  |  |  |  |  |  |  333|  33.3k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  33.3k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  33.3k| \
  |  |  |  |  |  |  335|  33.3k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  33.3k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  33.3k| \
  |  |  |  |  |  |  343|  33.3k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  33.3k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  33.3k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|  33.3k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  33.3k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  33.3k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|  33.3k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  33.3k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  33.3k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  33.3k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|  33.3k|    } \
  |  |  |  |  |  |  350|  33.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  33.3k|            } \
  |  |  |  | 1142|  33.3k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  89.0k|    } \
  |  |  |  | 1144|  89.0k|}
  |  |  ------------------
  |  | 1306|  89.0k|                                            flags, flagsp, flags_stride, data, \
  |  | 1307|  89.0k|                                            l_w, 3, mqc, curctx, \
  |  | 1308|  89.0k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1309|  89.0k|                        break; \
  |  | 1310|  89.0k|                } \
  |  | 1311|  2.85M|            } else { \
  |  | 1312|  2.85M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.85M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.85M|{ \
  |  |  |  | 1123|  2.85M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.85M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.85M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.85M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.85M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 719k, False: 2.13M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   719k|        do { \
  |  |  |  | 1125|   719k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   719k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   719k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   719k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   719k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   719k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   719k|{ \
  |  |  |  |  |  |  140|   719k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   719k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   719k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   719k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   719k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   719k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 109k, False: 609k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   109k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   109k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   109k|{ \
  |  |  |  |  |  |  |  |   57|   109k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.0k, False: 91.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  91.6k|    } else { \
  |  |  |  |  |  |  |  |   62|  91.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  91.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  91.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  91.6k|    } \
  |  |  |  |  |  |  |  |   66|   109k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   109k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   109k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   109k|{ \
  |  |  |  |  |  |  |  |  128|   207k|    do { \
  |  |  |  |  |  |  |  |  129|   207k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 25.8k, False: 181k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  25.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  25.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  25.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  25.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  25.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  25.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  25.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  25.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.03k, False: 19.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.03k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.79k, False: 236]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.79k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.79k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.79k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.79k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    236|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    236|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    236|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    236|            } \
  |  |  |  |  |  |  |  |  |  |  118|  19.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  19.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  19.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  19.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  19.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  25.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  25.8k|        } \
  |  |  |  |  |  |  |  |  132|   207k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   207k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   207k|        ct--; \
  |  |  |  |  |  |  |  |  135|   207k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 97.5k, False: 109k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   109k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   609k|    } else {  \
  |  |  |  |  |  |  149|   609k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   609k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 121k, False: 487k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   121k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   121k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   121k|{ \
  |  |  |  |  |  |  |  |   45|   121k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 14.1k, False: 107k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  14.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  14.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   107k|    } else { \
  |  |  |  |  |  |  |  |   49|   107k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   107k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   107k|    } \
  |  |  |  |  |  |  |  |   52|   121k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   121k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   121k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   121k|{ \
  |  |  |  |  |  |  |  |  128|   128k|    do { \
  |  |  |  |  |  |  |  |  129|   128k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15.9k, False: 112k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  15.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  15.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  15.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  15.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  15.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  15.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  15.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  15.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.91k, False: 12.0k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.91k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.75k, False: 162]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.75k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.75k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.75k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.75k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    162|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    162|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    162|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    162|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  12.0k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  12.0k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  12.0k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  12.0k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  15.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  15.9k|        } \
  |  |  |  |  |  |  |  |  132|   128k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   128k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   128k|        ct--; \
  |  |  |  |  |  |  |  |  135|   128k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.59k, False: 121k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   121k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   487k|        } else { \
  |  |  |  |  |  |  154|   487k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   487k|        } \
  |  |  |  |  |  |  156|   609k|    } \
  |  |  |  |  |  |  157|   719k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   719k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 573k, False: 145k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   719k|                    break; \
  |  |  |  | 1131|   719k|            } \
  |  |  |  | 1132|   719k|            { \
  |  |  |  | 1133|   145k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   145k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   145k|                                    ci); \
  |  |  |  | 1136|   145k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   145k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   145k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   145k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   145k|{ \
  |  |  |  |  |  |  140|   145k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   145k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   145k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   145k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   145k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   145k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 37.2k, False: 108k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  37.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  37.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  37.2k|{ \
  |  |  |  |  |  |  |  |   57|  37.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 7.84k, False: 29.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  7.84k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  7.84k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  7.84k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  29.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  29.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  29.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  29.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  29.4k|    } \
  |  |  |  |  |  |  |  |   66|  37.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  37.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  37.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  37.2k|{ \
  |  |  |  |  |  |  |  |  128|  60.4k|    do { \
  |  |  |  |  |  |  |  |  129|  60.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 7.42k, False: 53.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  7.42k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  7.42k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  7.42k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  7.42k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  7.42k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  7.42k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  7.42k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  7.42k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.07k, False: 4.35k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.07k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.94k, False: 132]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.94k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.94k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.94k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.94k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    132|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    132|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    132|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    132|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.35k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.35k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.35k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.35k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.35k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  7.42k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  7.42k|        } \
  |  |  |  |  |  |  |  |  132|  60.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  60.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  60.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  60.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 23.1k, False: 37.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  37.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   108k|    } else {  \
  |  |  |  |  |  |  149|   108k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   108k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 43.7k, False: 64.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  43.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  43.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  43.7k|{ \
  |  |  |  |  |  |  |  |   45|  43.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.13k, False: 37.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.13k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.13k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  37.6k|    } else { \
  |  |  |  |  |  |  |  |   49|  37.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  37.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  37.6k|    } \
  |  |  |  |  |  |  |  |   52|  43.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  43.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  43.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  43.7k|{ \
  |  |  |  |  |  |  |  |  128|  46.8k|    do { \
  |  |  |  |  |  |  |  |  129|  46.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.80k, False: 41.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.80k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.80k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.80k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.80k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.80k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.80k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.80k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.80k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.18k, False: 3.61k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.18k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.07k, False: 109]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.07k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.07k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.07k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.07k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    109|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    109|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    109|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    109|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.61k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.61k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.61k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.61k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.61k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.80k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.80k|        } \
  |  |  |  |  |  |  |  |  132|  46.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  46.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  46.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  46.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 3.07k, False: 43.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  43.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  64.5k|        } else { \
  |  |  |  |  |  |  154|  64.5k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  64.5k|        } \
  |  |  |  |  |  |  156|   108k|    } \
  |  |  |  |  |  |  157|   145k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   145k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   145k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 61.5k, False: 84.1k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   145k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   145k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   145k|{ \
  |  |  |  |  |  |  326|   145k|    /* east */ \
  |  |  |  |  |  |  327|   145k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   145k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   145k| \
  |  |  |  |  |  |  329|   145k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   145k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   145k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   145k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   145k| \
  |  |  |  |  |  |  332|   145k|    /* west */ \
  |  |  |  |  |  |  333|   145k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   145k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   145k| \
  |  |  |  |  |  |  335|   145k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   145k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|   145k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|   145k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|   145k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|   145k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|   145k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|   145k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|   145k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|   145k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|   145k|    } \
  |  |  |  |  |  |  342|   145k| \
  |  |  |  |  |  |  343|   145k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   145k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   145k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   145k|            } \
  |  |  |  | 1142|   145k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   719k|    } \
  |  |  |  | 1144|  2.85M|}
  |  |  ------------------
  |  | 1313|  2.85M|                                    flags, flagsp, flags_stride, data, \
  |  | 1314|  2.85M|                                    l_w, 0, mqc, curctx, \
  |  | 1315|  2.85M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1316|  2.85M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.85M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.85M|{ \
  |  |  |  | 1123|  2.85M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.85M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.85M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.85M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.85M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 730k, False: 2.12M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   730k|        do { \
  |  |  |  | 1125|   730k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   730k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   730k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   730k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   730k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   730k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   730k|{ \
  |  |  |  |  |  |  140|   730k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   730k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   730k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   730k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   730k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   730k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 102k, False: 627k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   102k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   102k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   102k|{ \
  |  |  |  |  |  |  |  |   57|   102k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 17.8k, False: 84.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  17.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  17.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  17.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  84.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  84.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  84.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  84.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  84.2k|    } \
  |  |  |  |  |  |  |  |   66|   102k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   102k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   102k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   102k|{ \
  |  |  |  |  |  |  |  |  128|   194k|    do { \
  |  |  |  |  |  |  |  |  129|   194k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24.3k, False: 169k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  24.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  24.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  24.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  24.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  24.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  24.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  24.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  24.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.85k, False: 18.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.85k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.60k, False: 255]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.60k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.60k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.60k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.60k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    255|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    255|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    255|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    255|            } \
  |  |  |  |  |  |  |  |  |  |  118|  18.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  18.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  18.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  18.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  18.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  24.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  24.3k|        } \
  |  |  |  |  |  |  |  |  132|   194k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   194k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   194k|        ct--; \
  |  |  |  |  |  |  |  |  135|   194k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 92.1k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   102k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   627k|    } else {  \
  |  |  |  |  |  |  149|   627k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   627k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 123k, False: 504k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   123k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   123k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   123k|{ \
  |  |  |  |  |  |  |  |   45|   123k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 13.1k, False: 109k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  13.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  13.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   109k|    } else { \
  |  |  |  |  |  |  |  |   49|   109k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   109k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   109k|    } \
  |  |  |  |  |  |  |  |   52|   123k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   123k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   123k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   123k|{ \
  |  |  |  |  |  |  |  |  128|   129k|    do { \
  |  |  |  |  |  |  |  |  129|   129k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.2k, False: 113k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.87k, False: 12.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.87k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.71k, False: 157]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.71k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.71k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.71k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.71k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    157|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    157|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    157|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    157|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  12.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  12.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  12.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  12.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.2k|        } \
  |  |  |  |  |  |  |  |  132|   129k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   129k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   129k|        ct--; \
  |  |  |  |  |  |  |  |  135|   129k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.45k, False: 123k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   123k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   504k|        } else { \
  |  |  |  |  |  |  154|   504k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   504k|        } \
  |  |  |  |  |  |  156|   627k|    } \
  |  |  |  |  |  |  157|   730k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   730k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 596k, False: 133k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   730k|                    break; \
  |  |  |  | 1131|   730k|            } \
  |  |  |  | 1132|   730k|            { \
  |  |  |  | 1133|   133k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   133k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   133k|                                    ci); \
  |  |  |  | 1136|   133k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   133k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   133k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   133k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   133k|{ \
  |  |  |  |  |  |  140|   133k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   133k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   133k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   133k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   133k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   133k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 36.4k, False: 96.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  36.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  36.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  36.4k|{ \
  |  |  |  |  |  |  |  |   57|  36.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 7.52k, False: 28.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  7.52k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  7.52k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  7.52k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  28.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  28.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  28.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  28.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  28.9k|    } \
  |  |  |  |  |  |  |  |   66|  36.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  36.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  36.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  36.4k|{ \
  |  |  |  |  |  |  |  |  128|  59.5k|    do { \
  |  |  |  |  |  |  |  |  129|  59.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 7.54k, False: 51.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  7.54k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  7.54k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  7.54k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  7.54k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  7.54k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  7.54k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  7.54k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  7.54k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.16k, False: 4.38k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.16k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.07k, False: 90]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.07k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.07k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.07k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.07k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     90|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     90|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     90|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     90|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.38k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.38k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.38k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.38k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.38k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  7.54k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  7.54k|        } \
  |  |  |  |  |  |  |  |  132|  59.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  59.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  59.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  59.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 23.0k, False: 36.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  36.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  96.9k|    } else {  \
  |  |  |  |  |  |  149|  96.9k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  96.9k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 40.1k, False: 56.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  40.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  40.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  40.1k|{ \
  |  |  |  |  |  |  |  |   45|  40.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 5.92k, False: 34.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  5.92k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  5.92k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  34.2k|    } else { \
  |  |  |  |  |  |  |  |   49|  34.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  34.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  34.2k|    } \
  |  |  |  |  |  |  |  |   52|  40.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  40.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  40.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  40.1k|{ \
  |  |  |  |  |  |  |  |  128|  42.9k|    do { \
  |  |  |  |  |  |  |  |  129|  42.9k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.56k, False: 37.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.56k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.56k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.56k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.56k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.56k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.56k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.56k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.56k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.25k, False: 3.31k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.25k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.15k, False: 91]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.15k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.15k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.15k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.15k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     91|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     91|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     91|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     91|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.31k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.31k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.31k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.31k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.31k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.56k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.56k|        } \
  |  |  |  |  |  |  |  |  132|  42.9k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  42.9k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  42.9k|        ct--; \
  |  |  |  |  |  |  |  |  135|  42.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.77k, False: 40.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  40.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.7k|        } else { \
  |  |  |  |  |  |  154|  56.7k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  56.7k|        } \
  |  |  |  |  |  |  156|  96.9k|    } \
  |  |  |  |  |  |  157|   133k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   133k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   133k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 56.8k, False: 76.5k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   133k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   133k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   133k|{ \
  |  |  |  |  |  |  326|   133k|    /* east */ \
  |  |  |  |  |  |  327|   133k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   133k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   133k| \
  |  |  |  |  |  |  329|   133k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   133k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   133k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   133k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   133k| \
  |  |  |  |  |  |  332|   133k|    /* west */ \
  |  |  |  |  |  |  333|   133k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   133k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   133k| \
  |  |  |  |  |  |  335|   133k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   133k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   133k| \
  |  |  |  |  |  |  343|   133k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   133k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   133k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   133k|            } \
  |  |  |  | 1142|   133k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   730k|    } \
  |  |  |  | 1144|  2.85M|}
  |  |  ------------------
  |  | 1317|  2.85M|                                    flags, flagsp, flags_stride, data, \
  |  | 1318|  2.85M|                                    l_w, 1, mqc, curctx, \
  |  | 1319|  2.85M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1320|  2.85M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.85M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.85M|{ \
  |  |  |  | 1123|  2.85M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.85M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.85M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.85M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.85M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 713k, False: 2.14M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   713k|        do { \
  |  |  |  | 1125|   713k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   713k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   713k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   713k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   713k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   713k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   713k|{ \
  |  |  |  |  |  |  140|   713k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   713k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   713k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   713k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   713k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   713k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 100k, False: 613k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   100k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   100k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   100k|{ \
  |  |  |  |  |  |  |  |   57|   100k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 16.5k, False: 83.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  16.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  16.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  16.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  83.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  83.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  83.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  83.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  83.7k|    } \
  |  |  |  |  |  |  |  |   66|   100k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   100k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   100k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   100k|{ \
  |  |  |  |  |  |  |  |  128|   192k|    do { \
  |  |  |  |  |  |  |  |  129|   192k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24.5k, False: 168k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  24.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  24.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  24.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  24.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  24.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  24.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  24.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  24.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.88k, False: 18.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.88k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.58k, False: 299]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.58k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.58k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.58k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.58k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    299|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    299|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    299|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    299|            } \
  |  |  |  |  |  |  |  |  |  |  118|  18.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  18.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  18.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  18.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  18.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  24.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  24.5k|        } \
  |  |  |  |  |  |  |  |  132|   192k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   192k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   192k|        ct--; \
  |  |  |  |  |  |  |  |  135|   192k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 92.2k, False: 100k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   100k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   613k|    } else {  \
  |  |  |  |  |  |  149|   613k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   613k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 119k, False: 494k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   119k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   119k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   119k|{ \
  |  |  |  |  |  |  |  |   45|   119k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 12.7k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  12.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  12.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   106k|    } else { \
  |  |  |  |  |  |  |  |   49|   106k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   106k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   106k|    } \
  |  |  |  |  |  |  |  |   52|   119k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   119k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   119k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   119k|{ \
  |  |  |  |  |  |  |  |  128|   125k|    do { \
  |  |  |  |  |  |  |  |  129|   125k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15.8k, False: 109k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  15.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  15.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  15.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  15.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  15.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  15.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  15.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  15.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.23k, False: 11.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.23k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.05k, False: 179]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.05k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.05k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.05k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.05k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    179|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    179|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    179|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    179|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  11.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  11.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  11.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  11.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  15.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  15.8k|        } \
  |  |  |  |  |  |  |  |  132|   125k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   125k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   125k|        ct--; \
  |  |  |  |  |  |  |  |  135|   125k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.28k, False: 119k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   119k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   494k|        } else { \
  |  |  |  |  |  |  154|   494k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   494k|        } \
  |  |  |  |  |  |  156|   613k|    } \
  |  |  |  |  |  |  157|   713k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   713k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 580k, False: 133k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   713k|                    break; \
  |  |  |  | 1131|   713k|            } \
  |  |  |  | 1132|   713k|            { \
  |  |  |  | 1133|   133k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   133k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   133k|                                    ci); \
  |  |  |  | 1136|   133k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   133k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   133k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   133k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   133k|{ \
  |  |  |  |  |  |  140|   133k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   133k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   133k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   133k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   133k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   133k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 36.5k, False: 96.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  36.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  36.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  36.5k|{ \
  |  |  |  |  |  |  |  |   57|  36.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 7.96k, False: 28.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  7.96k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  7.96k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  7.96k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  28.6k|    } else { \
  |  |  |  |  |  |  |  |   62|  28.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  28.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  28.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  28.6k|    } \
  |  |  |  |  |  |  |  |   66|  36.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  36.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  36.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  36.5k|{ \
  |  |  |  |  |  |  |  |  128|  59.0k|    do { \
  |  |  |  |  |  |  |  |  129|  59.0k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 7.21k, False: 51.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  7.21k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  7.21k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  7.21k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  7.21k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  7.21k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  7.21k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  7.21k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  7.21k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.05k, False: 4.15k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.05k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.93k, False: 125]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.93k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.93k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.93k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.93k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    125|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    125|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    125|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    125|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.15k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.15k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.15k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.15k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.15k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  7.21k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  7.21k|        } \
  |  |  |  |  |  |  |  |  132|  59.0k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  59.0k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  59.0k|        ct--; \
  |  |  |  |  |  |  |  |  135|  59.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 22.5k, False: 36.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  36.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  96.4k|    } else {  \
  |  |  |  |  |  |  149|  96.4k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  96.4k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 40.5k, False: 55.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  40.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  40.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  40.5k|{ \
  |  |  |  |  |  |  |  |   45|  40.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.10k, False: 34.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.10k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.10k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  34.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  34.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  34.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  34.4k|    } \
  |  |  |  |  |  |  |  |   52|  40.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  40.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  40.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  40.5k|{ \
  |  |  |  |  |  |  |  |  128|  43.4k|    do { \
  |  |  |  |  |  |  |  |  129|  43.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.69k, False: 37.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.69k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.69k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.69k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.69k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.69k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.69k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.69k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.69k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.29k, False: 3.40k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.29k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.22k, False: 70]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.22k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.22k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.22k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.22k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     70|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     70|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     70|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     70|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.40k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.40k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.40k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.40k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.40k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.69k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.69k|        } \
  |  |  |  |  |  |  |  |  132|  43.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  43.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  43.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  43.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.89k, False: 40.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  40.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  55.9k|        } else { \
  |  |  |  |  |  |  154|  55.9k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  55.9k|        } \
  |  |  |  |  |  |  156|  96.4k|    } \
  |  |  |  |  |  |  157|   133k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   133k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   133k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 56.6k, False: 76.4k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   133k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   133k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   133k|{ \
  |  |  |  |  |  |  326|   133k|    /* east */ \
  |  |  |  |  |  |  327|   133k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   133k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   133k| \
  |  |  |  |  |  |  329|   133k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   133k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   133k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   133k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   133k| \
  |  |  |  |  |  |  332|   133k|    /* west */ \
  |  |  |  |  |  |  333|   133k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   133k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   133k| \
  |  |  |  |  |  |  335|   133k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   133k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   133k| \
  |  |  |  |  |  |  343|   133k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   133k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   133k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   133k|            } \
  |  |  |  | 1142|   133k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   713k|    } \
  |  |  |  | 1144|  2.85M|}
  |  |  ------------------
  |  | 1321|  2.85M|                                    flags, flagsp, flags_stride, data, \
  |  | 1322|  2.85M|                                    l_w, 2, mqc, curctx, \
  |  | 1323|  2.85M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1324|  2.85M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.85M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.85M|{ \
  |  |  |  | 1123|  2.85M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.85M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.85M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.85M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.85M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 761k, False: 2.09M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   761k|        do { \
  |  |  |  | 1125|   761k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   761k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   761k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   761k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   761k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   761k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   761k|{ \
  |  |  |  |  |  |  140|   761k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   761k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   761k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   761k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   761k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   761k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 116k, False: 644k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   116k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   116k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   116k|{ \
  |  |  |  |  |  |  |  |   57|   116k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 19.3k, False: 97.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  19.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  19.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  19.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  97.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  97.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  97.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  97.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  97.2k|    } \
  |  |  |  |  |  |  |  |   66|   116k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   116k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   116k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   116k|{ \
  |  |  |  |  |  |  |  |  128|   221k|    do { \
  |  |  |  |  |  |  |  |  129|   221k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 27.4k, False: 193k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  27.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  27.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  27.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  27.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  27.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  27.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  27.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  27.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.63k, False: 21.7k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.63k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.41k, False: 222]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.41k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.41k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.41k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.41k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    222|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    222|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    222|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    222|            } \
  |  |  |  |  |  |  |  |  |  |  118|  21.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  21.7k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  21.7k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  21.7k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  21.7k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  27.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  27.4k|        } \
  |  |  |  |  |  |  |  |  132|   221k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   221k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   221k|        ct--; \
  |  |  |  |  |  |  |  |  135|   221k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 104k, False: 116k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   116k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   644k|    } else {  \
  |  |  |  |  |  |  149|   644k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   644k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 130k, False: 514k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   130k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   130k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   130k|{ \
  |  |  |  |  |  |  |  |   45|   130k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 15.4k, False: 115k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  15.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  15.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   115k|    } else { \
  |  |  |  |  |  |  |  |   49|   115k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   115k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   115k|    } \
  |  |  |  |  |  |  |  |   52|   130k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   130k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   130k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   130k|{ \
  |  |  |  |  |  |  |  |  128|   138k|    do { \
  |  |  |  |  |  |  |  |  129|   138k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.4k, False: 120k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  17.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  17.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  17.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  17.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  17.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  17.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  17.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  17.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.88k, False: 13.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.88k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.70k, False: 175]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.70k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.70k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.70k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.70k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    175|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    175|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    175|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    175|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  13.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  13.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  13.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  13.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.4k|        } \
  |  |  |  |  |  |  |  |  132|   138k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   138k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   138k|        ct--; \
  |  |  |  |  |  |  |  |  135|   138k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.59k, False: 130k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   130k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   514k|        } else { \
  |  |  |  |  |  |  154|   514k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   514k|        } \
  |  |  |  |  |  |  156|   644k|    } \
  |  |  |  |  |  |  157|   761k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   761k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 611k, False: 149k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   761k|                    break; \
  |  |  |  | 1131|   761k|            } \
  |  |  |  | 1132|   761k|            { \
  |  |  |  | 1133|   149k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   149k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   149k|                                    ci); \
  |  |  |  | 1136|   149k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   149k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   149k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   149k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   149k|{ \
  |  |  |  |  |  |  140|   149k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   149k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   149k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   149k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   149k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   149k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 39.5k, False: 110k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  39.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  39.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  39.5k|{ \
  |  |  |  |  |  |  |  |   57|  39.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 8.07k, False: 31.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  8.07k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  8.07k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  8.07k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  31.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  31.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  31.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  31.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  31.4k|    } \
  |  |  |  |  |  |  |  |   66|  39.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  39.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  39.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  39.5k|{ \
  |  |  |  |  |  |  |  |  128|  65.2k|    do { \
  |  |  |  |  |  |  |  |  129|  65.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 8.09k, False: 57.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  8.09k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  8.09k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  8.09k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  8.09k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  8.09k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  8.09k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  8.09k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  8.09k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.05k, False: 5.04k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.05k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.94k, False: 115]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.94k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.94k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.94k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.94k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    115|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    115|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    115|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    115|            } \
  |  |  |  |  |  |  |  |  |  |  118|  5.04k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.04k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.04k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.04k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.04k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  8.09k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  8.09k|        } \
  |  |  |  |  |  |  |  |  132|  65.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  65.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  65.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  65.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 25.7k, False: 39.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  39.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   110k|    } else {  \
  |  |  |  |  |  |  149|   110k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   110k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 44.4k, False: 65.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  44.4k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  44.4k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  44.4k|{ \
  |  |  |  |  |  |  |  |   45|  44.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.47k, False: 38.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.47k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.47k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  38.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  38.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  38.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  38.0k|    } \
  |  |  |  |  |  |  |  |   52|  44.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  44.4k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  44.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  44.4k|{ \
  |  |  |  |  |  |  |  |  128|  47.6k|    do { \
  |  |  |  |  |  |  |  |  129|  47.6k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.96k, False: 41.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.96k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.96k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.96k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.96k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.96k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.96k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.96k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.96k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.18k, False: 3.78k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.18k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.11k, False: 65]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.11k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.11k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.11k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.11k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     65|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     65|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     65|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     65|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.78k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.78k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.78k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.78k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.78k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.96k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.96k|        } \
  |  |  |  |  |  |  |  |  132|  47.6k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  47.6k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  47.6k|        ct--; \
  |  |  |  |  |  |  |  |  135|  47.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 3.15k, False: 44.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  44.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  65.7k|        } else { \
  |  |  |  |  |  |  154|  65.7k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  65.7k|        } \
  |  |  |  |  |  |  156|   110k|    } \
  |  |  |  |  |  |  157|   149k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   149k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   149k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 62.8k, False: 86.9k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   149k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   149k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   149k|{ \
  |  |  |  |  |  |  326|   149k|    /* east */ \
  |  |  |  |  |  |  327|   149k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   149k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   149k| \
  |  |  |  |  |  |  329|   149k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   149k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   149k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   149k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   149k| \
  |  |  |  |  |  |  332|   149k|    /* west */ \
  |  |  |  |  |  |  333|   149k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   149k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   149k| \
  |  |  |  |  |  |  335|   149k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   149k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   149k| \
  |  |  |  |  |  |  343|   149k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   149k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   149k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   149k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   149k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   149k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   149k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   149k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   149k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   149k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   149k|    } \
  |  |  |  |  |  |  350|   149k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   149k|            } \
  |  |  |  | 1142|   149k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   761k|    } \
  |  |  |  | 1144|  2.85M|}
  |  |  ------------------
  |  | 1325|  2.85M|                                    flags, flagsp, flags_stride, data, \
  |  | 1326|  2.85M|                                    l_w, 3, mqc, curctx, \
  |  | 1327|  2.85M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1328|  2.85M|            } \
  |  | 1329|  6.53M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  2.94M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  2.94M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  2.94M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  2.94M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1330|  2.94M|        } \
  |  | 1331|   102k|    } \
  |  | 1332|  6.38k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  6.38k|        mqc->curctx = curctx; \
  |  |  |  |  167|  6.38k|        mqc->c = c; \
  |  |  |  |  168|  6.38k|        mqc->a = a; \
  |  |  |  |  169|  6.38k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1333|  6.38k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1333:9): [True: 0, False: 6.38k]
  |  |  ------------------
  |  | 1334|      0|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1334:21): [True: 0, False: 0]
  |  |  ------------------
  |  | 1335|      0|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1335:25): [True: 0, False: 0]
  |  |  ------------------
  |  | 1336|      0|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1337|      0|            } \
  |  | 1338|      0|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|      0|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|      0|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|      0|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1339|      0|        } \
  |  | 1340|      0|    } \
  |  | 1341|  6.38k|}
  ------------------
 1369|  6.38k|}
t1.c:opj_t1_dec_clnpass_generic_vsc:
 1389|  10.3k|{
 1390|  10.3k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_TRUE, t1->w, t1->h,
  ------------------
  |  | 1254|  10.3k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1255|  10.3k|{ \
  |  | 1256|  10.3k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1257|  10.3k|    OPJ_UINT32 runlen; \
  |  | 1258|  10.3k|    OPJ_UINT32 i, j, k; \
  |  | 1259|  10.3k|    const OPJ_UINT32 l_w = w; \
  |  | 1260|  10.3k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1261|  10.3k|    register OPJ_INT32 *data = t1->data; \
  |  | 1262|  10.3k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1263|  10.3k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  10.3k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  10.3k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  10.3k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  10.3k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1264|  10.3k|    register OPJ_UINT32 v; \
  |  | 1265|  10.3k|    one = 1 << bpno; \
  |  | 1266|  10.3k|    half = one >> 1; \
  |  | 1267|  10.3k|    oneplushalf = one | half; \
  |  | 1268|  67.9k|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 57.6k, False: 10.3k]
  |  |  ------------------
  |  | 1269|  4.09M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1269:21): [True: 4.03M, False: 57.6k]
  |  |  ------------------
  |  | 1270|  4.03M|            opj_flag_t flags = *flagsp; \
  |  | 1271|  4.03M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1271:17): [True: 1.39M, False: 2.64M]
  |  |  ------------------
  |  | 1272|  1.39M|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  1.39M|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1273|  1.39M|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   65|  1.39M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1274|  1.39M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  1.39M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  1.39M|{ \
  |  |  |  |  140|  1.39M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  1.39M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  1.39M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  1.39M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  1.39M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  1.39M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 205k, False: 1.18M]
  |  |  |  |  ------------------
  |  |  |  |  146|   205k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   205k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   205k|{ \
  |  |  |  |  |  |   57|   205k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 25.9k, False: 179k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  25.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  25.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  25.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   179k|    } else { \
  |  |  |  |  |  |   62|   179k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   179k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   179k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   179k|    } \
  |  |  |  |  |  |   66|   205k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   205k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   205k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   205k|{ \
  |  |  |  |  |  |  128|   397k|    do { \
  |  |  |  |  |  |  129|   397k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 52.1k, False: 345k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  52.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  52.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  52.1k|{ \
  |  |  |  |  |  |  |  |  104|  52.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  52.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  52.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  52.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  52.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 46.7k, False: 5.38k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  46.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 46.4k, False: 330]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  46.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  46.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  46.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  46.4k|            } else { \
  |  |  |  |  |  |  |  |  114|    330|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    330|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    330|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    330|            } \
  |  |  |  |  |  |  |  |  118|  46.7k|        } else { \
  |  |  |  |  |  |  |  |  119|  5.38k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  5.38k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  5.38k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  5.38k|        } \
  |  |  |  |  |  |  |  |  123|  52.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  52.1k|        } \
  |  |  |  |  |  |  132|   397k|        a <<= 1; \
  |  |  |  |  |  |  133|   397k|        c <<= 1; \
  |  |  |  |  |  |  134|   397k|        ct--; \
  |  |  |  |  |  |  135|   397k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 191k, False: 205k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   205k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  1.18M|    } else {  \
  |  |  |  |  149|  1.18M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  1.18M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 237k, False: 947k]
  |  |  |  |  ------------------
  |  |  |  |  151|   237k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   237k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   237k|{ \
  |  |  |  |  |  |   45|   237k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 22.2k, False: 215k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  22.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  22.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   215k|    } else { \
  |  |  |  |  |  |   49|   215k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   215k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   215k|    } \
  |  |  |  |  |  |   52|   237k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   237k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   237k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   237k|{ \
  |  |  |  |  |  |  128|   247k|    do { \
  |  |  |  |  |  |  129|   247k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 36.5k, False: 211k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  36.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  36.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  36.5k|{ \
  |  |  |  |  |  |  |  |  104|  36.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  36.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  36.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  36.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  36.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 34.9k, False: 1.61k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  34.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 34.7k, False: 115]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  34.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  34.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  34.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  34.7k|            } else { \
  |  |  |  |  |  |  |  |  114|    115|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    115|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    115|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    115|            } \
  |  |  |  |  |  |  |  |  118|  34.9k|        } else { \
  |  |  |  |  |  |  |  |  119|  1.61k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  1.61k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  1.61k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  1.61k|        } \
  |  |  |  |  |  |  |  |  123|  36.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  36.5k|        } \
  |  |  |  |  |  |  132|   247k|        a <<= 1; \
  |  |  |  |  |  |  133|   247k|        c <<= 1; \
  |  |  |  |  |  |  134|   247k|        ct--; \
  |  |  |  |  |  |  135|   247k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 9.84k, False: 237k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   237k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   947k|        } else { \
  |  |  |  |  154|   947k|            d = (*curctx)->mps; \
  |  |  |  |  155|   947k|        } \
  |  |  |  |  156|  1.18M|    } \
  |  |  |  |  157|  1.39M|}
  |  |  ------------------
  |  | 1275|  1.39M|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1275:21): [True: 1.17M, False: 218k]
  |  |  ------------------
  |  | 1276|  1.17M|                    continue; \
  |  | 1277|  1.17M|                } \
  |  | 1278|  1.39M|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   65|   218k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1279|   218k|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   218k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   218k|{ \
  |  |  |  |  140|   218k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   218k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   218k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   218k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   218k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   218k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 109k, False: 108k]
  |  |  |  |  ------------------
  |  |  |  |  146|   109k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   109k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   109k|{ \
  |  |  |  |  |  |   57|   109k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 62.4k, False: 47.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  62.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  62.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  62.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  62.4k|    } else { \
  |  |  |  |  |  |   62|  47.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  47.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  47.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  47.1k|    } \
  |  |  |  |  |  |   66|   109k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   109k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   109k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   109k|{ \
  |  |  |  |  |  |  128|   109k|    do { \
  |  |  |  |  |  |  129|   109k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 13.9k, False: 95.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  13.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  13.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  13.9k|{ \
  |  |  |  |  |  |  |  |  104|  13.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  13.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  13.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  13.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  13.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.6k, False: 301]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  13.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.6k, False: 29]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  13.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  13.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  13.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  13.6k|            } else { \
  |  |  |  |  |  |  |  |  114|     29|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     29|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     29|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     29|            } \
  |  |  |  |  |  |  |  |  118|  13.6k|        } else { \
  |  |  |  |  |  |  |  |  119|    301|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    301|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    301|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    301|        } \
  |  |  |  |  |  |  |  |  123|  13.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  13.9k|        } \
  |  |  |  |  |  |  132|   109k|        a <<= 1; \
  |  |  |  |  |  |  133|   109k|        c <<= 1; \
  |  |  |  |  |  |  134|   109k|        ct--; \
  |  |  |  |  |  |  135|   109k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 109k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   109k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   109k|    } else {  \
  |  |  |  |  149|   108k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   108k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 89.5k, False: 19.3k]
  |  |  |  |  ------------------
  |  |  |  |  151|  89.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  89.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  89.5k|{ \
  |  |  |  |  |  |   45|  89.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 44.4k, False: 45.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  44.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  44.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  45.0k|    } else { \
  |  |  |  |  |  |   49|  45.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  45.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  45.0k|    } \
  |  |  |  |  |  |   52|  89.5k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  89.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  89.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  89.5k|{ \
  |  |  |  |  |  |  128|   109k|    do { \
  |  |  |  |  |  |  129|   109k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 13.1k, False: 96.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  13.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  13.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  13.1k|{ \
  |  |  |  |  |  |  |  |  104|  13.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  13.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  13.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  13.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  13.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.4k, False: 729]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  12.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.3k, False: 35]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  12.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  12.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  12.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  12.3k|            } else { \
  |  |  |  |  |  |  |  |  114|     35|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     35|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     35|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     35|            } \
  |  |  |  |  |  |  |  |  118|  12.4k|        } else { \
  |  |  |  |  |  |  |  |  119|    729|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    729|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    729|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    729|        } \
  |  |  |  |  |  |  |  |  123|  13.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  13.1k|        } \
  |  |  |  |  |  |  132|   109k|        a <<= 1; \
  |  |  |  |  |  |  133|   109k|        c <<= 1; \
  |  |  |  |  |  |  134|   109k|        ct--; \
  |  |  |  |  |  |  135|   109k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 19.8k, False: 89.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  89.5k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  89.5k|        } else { \
  |  |  |  |  154|  19.3k|            d = (*curctx)->mps; \
  |  |  |  |  155|  19.3k|        } \
  |  |  |  |  156|   108k|    } \
  |  |  |  |  157|   218k|}
  |  |  ------------------
  |  | 1280|   218k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   218k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   218k|{ \
  |  |  |  |  140|   218k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   218k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   218k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   218k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   218k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   218k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 106k, False: 112k]
  |  |  |  |  ------------------
  |  |  |  |  146|   106k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   106k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   106k|{ \
  |  |  |  |  |  |   57|   106k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 24.7k, False: 81.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  24.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  24.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  24.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  81.3k|    } else { \
  |  |  |  |  |  |   62|  81.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  81.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  81.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  81.3k|    } \
  |  |  |  |  |  |   66|   106k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   106k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   106k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   106k|{ \
  |  |  |  |  |  |  128|   106k|    do { \
  |  |  |  |  |  |  129|   106k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 10.2k, False: 95.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  10.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  10.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  10.2k|{ \
  |  |  |  |  |  |  |  |  104|  10.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  10.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  10.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  10.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  10.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.85k, False: 382]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  9.85k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.80k, False: 47]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  9.80k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  9.80k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  9.80k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  9.80k|            } else { \
  |  |  |  |  |  |  |  |  114|     47|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     47|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     47|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     47|            } \
  |  |  |  |  |  |  |  |  118|  9.85k|        } else { \
  |  |  |  |  |  |  |  |  119|    382|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    382|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    382|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    382|        } \
  |  |  |  |  |  |  |  |  123|  10.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  10.2k|        } \
  |  |  |  |  |  |  132|   106k|        a <<= 1; \
  |  |  |  |  |  |  133|   106k|        c <<= 1; \
  |  |  |  |  |  |  134|   106k|        ct--; \
  |  |  |  |  |  |  135|   106k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 106k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   106k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   112k|    } else {  \
  |  |  |  |  149|   112k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   112k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 91.5k, False: 20.8k]
  |  |  |  |  ------------------
  |  |  |  |  151|  91.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  91.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  91.5k|{ \
  |  |  |  |  |  |   45|  91.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 19.3k, False: 72.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  19.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  19.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  72.2k|    } else { \
  |  |  |  |  |  |   49|  72.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  72.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  72.2k|    } \
  |  |  |  |  |  |   52|  91.5k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  91.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  91.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  91.5k|{ \
  |  |  |  |  |  |  128|   103k|    do { \
  |  |  |  |  |  |  129|   103k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 13.7k, False: 89.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  13.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  13.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  13.7k|{ \
  |  |  |  |  |  |  |  |  104|  13.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  13.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  13.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  13.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  13.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.8k, False: 981]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  12.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.7k, False: 37]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  12.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  12.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  12.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  12.7k|            } else { \
  |  |  |  |  |  |  |  |  114|     37|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     37|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     37|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     37|            } \
  |  |  |  |  |  |  |  |  118|  12.8k|        } else { \
  |  |  |  |  |  |  |  |  119|    981|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    981|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    981|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    981|        } \
  |  |  |  |  |  |  |  |  123|  13.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  13.7k|        } \
  |  |  |  |  |  |  132|   103k|        a <<= 1; \
  |  |  |  |  |  |  133|   103k|        c <<= 1; \
  |  |  |  |  |  |  134|   103k|        ct--; \
  |  |  |  |  |  |  135|   103k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 11.9k, False: 91.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  91.5k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  91.5k|        } else { \
  |  |  |  |  154|  20.8k|            d = (*curctx)->mps; \
  |  |  |  |  155|  20.8k|        } \
  |  |  |  |  156|   112k|    } \
  |  |  |  |  157|   218k|}
  |  |  ------------------
  |  | 1281|   218k|                runlen = (runlen << 1) | v; \
  |  | 1282|   218k|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1282:24): [True: 0, False: 218k]
  |  |  ------------------
  |  | 1283|  70.0k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1283:21): [True: 70.0k, False: 148k]
  |  |  ------------------
  |  | 1284|  70.0k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1121|  70.0k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  70.0k|{ \
  |  |  |  | 1123|  70.0k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  70.0k|        do { \
  |  |  |  | 1125|  70.0k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|      0|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|      0|{ \
  |  |  |  |  |  |  140|      0|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|      0|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|      0|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|      0|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|      0|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|      0|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|      0|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|      0|{ \
  |  |  |  |  |  |  |  |   57|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|      0|    } else { \
  |  |  |  |  |  |  |  |   62|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|      0|    } \
  |  |  |  |  |  |  |  |   66|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|      0|    } else {  \
  |  |  |  |  |  |  149|      0|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|      0|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|      0|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|      0|{ \
  |  |  |  |  |  |  |  |   45|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|      0|    } else { \
  |  |  |  |  |  |  |  |   49|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|      0|    } \
  |  |  |  |  |  |  |  |   52|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|        } else { \
  |  |  |  |  |  |  154|      0|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      0|        } \
  |  |  |  |  |  |  156|      0|    } \
  |  |  |  |  |  |  157|      0|}
  |  |  |  |  ------------------
  |  |  |  | 1129|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1130|      0|                    break; \
  |  |  |  | 1131|      0|            } \
  |  |  |  | 1132|  70.0k|            { \
  |  |  |  | 1133|  70.0k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  70.0k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  70.0k|                                    ci); \
  |  |  |  | 1136|  70.0k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  70.0k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  70.0k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  70.0k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  70.0k|{ \
  |  |  |  |  |  |  140|  70.0k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  70.0k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  70.0k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  70.0k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  70.0k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  70.0k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 25.1k, False: 44.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  25.1k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  25.1k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  25.1k|{ \
  |  |  |  |  |  |  |  |   57|  25.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 2.26k, False: 22.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  2.26k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  2.26k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  2.26k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  22.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  22.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  22.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  22.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  22.8k|    } \
  |  |  |  |  |  |  |  |   66|  25.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  25.1k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  25.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  25.1k|{ \
  |  |  |  |  |  |  |  |  128|  39.2k|    do { \
  |  |  |  |  |  |  |  |  129|  39.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.33k, False: 34.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.33k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.33k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.33k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.33k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.33k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.33k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.33k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.33k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.24k, False: 96]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.24k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.22k, False: 14]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.22k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.22k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.22k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.22k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     14|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     14|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     14|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     14|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.24k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     96|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     96|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     96|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     96|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.33k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.33k|        } \
  |  |  |  |  |  |  |  |  132|  39.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  39.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  39.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  39.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 14.0k, False: 25.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  25.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  44.8k|    } else {  \
  |  |  |  |  |  |  149|  44.8k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  44.8k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 24.4k, False: 20.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  24.4k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  24.4k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  24.4k|{ \
  |  |  |  |  |  |  |  |   45|  24.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.44k, False: 23.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.44k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.44k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  23.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  23.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  23.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  23.0k|    } \
  |  |  |  |  |  |  |  |   52|  24.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  24.4k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  24.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  24.4k|{ \
  |  |  |  |  |  |  |  |  128|  24.5k|    do { \
  |  |  |  |  |  |  |  |  129|  24.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.59k, False: 20.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.59k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.59k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.59k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.59k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.59k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.59k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.59k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.59k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.51k, False: 81]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.51k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.50k, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.50k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.50k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.50k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.50k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      6|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      6|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      6|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      6|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.51k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     81|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     81|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     81|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     81|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.59k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.59k|        } \
  |  |  |  |  |  |  |  |  132|  24.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  24.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  24.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  24.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 87, False: 24.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  24.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  24.4k|        } else { \
  |  |  |  |  |  |  154|  20.4k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  20.4k|        } \
  |  |  |  |  |  |  156|  44.8k|    } \
  |  |  |  |  |  |  157|  70.0k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  70.0k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  70.0k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 32.5k, False: 37.4k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  70.0k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  70.0k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  70.0k|{ \
  |  |  |  |  |  |  326|  70.0k|    /* east */ \
  |  |  |  |  |  |  327|  70.0k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  70.0k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  70.0k| \
  |  |  |  |  |  |  329|  70.0k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  70.0k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  70.0k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  70.0k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  70.0k| \
  |  |  |  |  |  |  332|  70.0k|    /* west */ \
  |  |  |  |  |  |  333|  70.0k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  70.0k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  70.0k| \
  |  |  |  |  |  |  335|  70.0k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  70.0k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  70.0k| \
  |  |  |  |  |  |  343|  70.0k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  70.0k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  70.0k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  70.0k|            } \
  |  |  |  | 1142|  70.0k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  70.0k|    } \
  |  |  |  | 1144|  70.0k|}
  |  |  ------------------
  |  | 1285|  70.0k|                                            flags, flagsp, flags_stride, data, \
  |  | 1286|  70.0k|                                            l_w, 0, mqc, curctx, \
  |  | 1287|  70.0k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1288|  70.0k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  70.0k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1289|  70.0k|                        /* FALLTHRU */ \
  |  | 1290|   126k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1290:21): [True: 56.8k, False: 161k]
  |  |  ------------------
  |  | 1291|   126k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|   126k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|   126k|{ \
  |  |  |  | 1123|   126k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|   126k|        do { \
  |  |  |  | 1125|   126k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 70.0k, False: 56.8k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  70.0k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  70.0k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  70.0k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  70.0k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  70.0k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  70.0k|{ \
  |  |  |  |  |  |  140|  70.0k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  70.0k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  70.0k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  70.0k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  70.0k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  70.0k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 17.1k, False: 52.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  17.1k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  17.1k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  17.1k|{ \
  |  |  |  |  |  |  |  |   57|  17.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 4.21k, False: 12.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  4.21k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  4.21k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  4.21k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  12.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  12.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  12.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  12.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  12.9k|    } \
  |  |  |  |  |  |  |  |   66|  17.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  17.1k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  17.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  17.1k|{ \
  |  |  |  |  |  |  |  |  128|  26.1k|    do { \
  |  |  |  |  |  |  |  |  129|  26.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.32k, False: 22.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.32k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.32k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.32k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.32k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.32k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.32k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.32k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.32k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.09k, False: 228]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.09k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.08k, False: 13]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.08k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.08k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.08k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.08k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     13|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     13|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     13|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     13|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.09k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    228|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    228|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    228|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    228|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.32k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.32k|        } \
  |  |  |  |  |  |  |  |  132|  26.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  26.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  26.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  26.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9.03k, False: 17.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  17.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  52.9k|    } else {  \
  |  |  |  |  |  |  149|  52.9k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  52.9k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 19.3k, False: 33.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  19.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  19.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  19.3k|{ \
  |  |  |  |  |  |  |  |   45|  19.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 2.95k, False: 16.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  2.95k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  2.95k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  16.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  16.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  16.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  16.4k|    } \
  |  |  |  |  |  |  |  |   52|  19.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  19.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  19.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  19.3k|{ \
  |  |  |  |  |  |  |  |  128|  21.1k|    do { \
  |  |  |  |  |  |  |  |  129|  21.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.06k, False: 18.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.06k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.06k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.06k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.06k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.06k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.06k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.06k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.06k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.88k, False: 178]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.88k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.86k, False: 21]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.86k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.86k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.86k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.86k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     21|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     21|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     21|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     21|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.88k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    178|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    178|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    178|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    178|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.06k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.06k|        } \
  |  |  |  |  |  |  |  |  132|  21.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  21.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  21.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  21.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.73k, False: 19.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  19.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  33.5k|        } else { \
  |  |  |  |  |  |  154|  33.5k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  33.5k|        } \
  |  |  |  |  |  |  156|  52.9k|    } \
  |  |  |  |  |  |  157|  70.0k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  70.0k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 28.6k, False: 41.4k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  70.0k|                    break; \
  |  |  |  | 1131|  70.0k|            } \
  |  |  |  | 1132|   126k|            { \
  |  |  |  | 1133|  98.3k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  98.3k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  98.3k|                                    ci); \
  |  |  |  | 1136|  98.3k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  98.3k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  98.3k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  98.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  98.3k|{ \
  |  |  |  |  |  |  140|  98.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  98.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  98.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  98.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  98.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  98.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 30.5k, False: 67.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  30.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  30.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  30.5k|{ \
  |  |  |  |  |  |  |  |   57|  30.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.35k, False: 29.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.35k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.35k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.35k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  29.1k|    } else { \
  |  |  |  |  |  |  |  |   62|  29.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  29.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  29.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  29.1k|    } \
  |  |  |  |  |  |  |  |   66|  30.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  30.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  30.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  30.5k|{ \
  |  |  |  |  |  |  |  |  128|  51.1k|    do { \
  |  |  |  |  |  |  |  |  129|  51.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.66k, False: 45.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.66k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.66k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.66k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.66k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.66k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.66k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.66k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.66k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.55k, False: 116]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.55k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.54k, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.54k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.54k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.54k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.54k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      7|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      7|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      7|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      7|            } \
  |  |  |  |  |  |  |  |  |  |  118|  5.55k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    116|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    116|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    116|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    116|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.66k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.66k|        } \
  |  |  |  |  |  |  |  |  132|  51.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  51.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  51.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  51.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 20.5k, False: 30.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  30.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  67.7k|    } else {  \
  |  |  |  |  |  |  149|  67.7k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  67.7k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 28.5k, False: 39.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  28.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  28.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  28.5k|{ \
  |  |  |  |  |  |  |  |   45|  28.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.46k, False: 27.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.46k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.46k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  27.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  27.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  27.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  27.0k|    } \
  |  |  |  |  |  |  |  |   52|  28.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  28.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  28.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  28.5k|{ \
  |  |  |  |  |  |  |  |  128|  29.2k|    do { \
  |  |  |  |  |  |  |  |  129|  29.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.02k, False: 26.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.02k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.02k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.02k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.02k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.02k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.02k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.02k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.02k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.89k, False: 132]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.89k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.88k, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.88k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.88k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.88k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.88k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      7|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      7|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      7|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      7|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.89k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    132|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    132|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    132|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    132|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.02k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.02k|        } \
  |  |  |  |  |  |  |  |  132|  29.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  29.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  29.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  29.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 782, False: 28.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  28.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  39.2k|        } else { \
  |  |  |  |  |  |  154|  39.2k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  39.2k|        } \
  |  |  |  |  |  |  156|  67.7k|    } \
  |  |  |  |  |  |  157|  98.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  98.3k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  98.3k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 48.1k, False: 50.1k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  98.3k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  98.3k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  98.3k|{ \
  |  |  |  |  |  |  326|  98.3k|    /* east */ \
  |  |  |  |  |  |  327|  98.3k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  98.3k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  98.3k| \
  |  |  |  |  |  |  329|  98.3k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  98.3k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  98.3k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  98.3k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  98.3k| \
  |  |  |  |  |  |  332|  98.3k|    /* west */ \
  |  |  |  |  |  |  333|  98.3k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  98.3k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  98.3k| \
  |  |  |  |  |  |  335|  98.3k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  98.3k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  98.3k| \
  |  |  |  |  |  |  343|  98.3k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  98.3k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  98.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  98.3k|            } \
  |  |  |  | 1142|  98.3k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   126k|    } \
  |  |  |  | 1144|   126k|}
  |  |  ------------------
  |  | 1292|   126k|                                            flags, flagsp, flags_stride, data, \
  |  | 1293|   126k|                                            l_w, 1, mqc, curctx, \
  |  | 1294|   126k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1295|   126k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   126k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1296|   126k|                        /* FALLTHRU */ \
  |  | 1297|   174k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1297:21): [True: 47.7k, False: 170k]
  |  |  ------------------
  |  | 1298|   174k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|   174k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|   174k|{ \
  |  |  |  | 1123|   174k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|   174k|        do { \
  |  |  |  | 1125|   174k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 126k, False: 47.7k]
  |  |  |  |  ------------------
  |  |  |  | 1126|   126k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   126k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   126k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   126k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   126k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   126k|{ \
  |  |  |  |  |  |  140|   126k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   126k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   126k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   126k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   126k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   126k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 28.9k, False: 98.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  28.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  28.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  28.9k|{ \
  |  |  |  |  |  |  |  |   57|  28.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 6.44k, False: 22.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  6.44k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  6.44k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  6.44k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  22.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  22.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  22.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  22.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  22.4k|    } \
  |  |  |  |  |  |  |  |   66|  28.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  28.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  28.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  28.9k|{ \
  |  |  |  |  |  |  |  |  128|  48.9k|    do { \
  |  |  |  |  |  |  |  |  129|  48.9k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.16k, False: 43.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.16k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.16k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.16k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.16k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.16k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.16k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.16k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.16k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.81k, False: 347]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.81k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.80k, False: 14]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.80k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.80k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.80k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.80k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     14|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     14|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     14|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     14|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.81k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    347|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    347|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    347|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    347|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.16k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.16k|        } \
  |  |  |  |  |  |  |  |  132|  48.9k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  48.9k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  48.9k|        ct--; \
  |  |  |  |  |  |  |  |  135|  48.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 19.9k, False: 28.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  28.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  98.0k|    } else {  \
  |  |  |  |  |  |  149|  98.0k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  98.0k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 27.5k, False: 70.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  27.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  27.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  27.5k|{ \
  |  |  |  |  |  |  |  |   45|  27.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.11k, False: 23.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.11k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.11k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  23.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  23.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  23.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  23.4k|    } \
  |  |  |  |  |  |  |  |   52|  27.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  27.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  27.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  27.5k|{ \
  |  |  |  |  |  |  |  |  128|  29.5k|    do { \
  |  |  |  |  |  |  |  |  129|  29.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.39k, False: 26.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.39k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.39k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.39k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.39k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.39k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.39k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.39k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.39k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.15k, False: 238]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.15k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.14k, False: 18]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.14k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.14k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.14k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.14k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     18|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     18|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     18|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     18|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.15k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    238|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    238|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    238|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    238|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.39k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.39k|        } \
  |  |  |  |  |  |  |  |  132|  29.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  29.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  29.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  29.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.06k, False: 27.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  27.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  70.4k|        } else { \
  |  |  |  |  |  |  154|  70.4k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  70.4k|        } \
  |  |  |  |  |  |  156|  98.0k|    } \
  |  |  |  |  |  |  157|   126k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   126k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 61.9k, False: 64.9k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   126k|                    break; \
  |  |  |  | 1131|   126k|            } \
  |  |  |  | 1132|   174k|            { \
  |  |  |  | 1133|   112k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   112k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   112k|                                    ci); \
  |  |  |  | 1136|   112k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   112k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   112k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   112k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   112k|{ \
  |  |  |  |  |  |  140|   112k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   112k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   112k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   112k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   112k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   112k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 27.4k, False: 85.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  27.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  27.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  27.4k|{ \
  |  |  |  |  |  |  |  |   57|  27.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 3.98k, False: 23.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  3.98k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  3.98k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  3.98k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  23.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  23.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  23.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  23.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  23.4k|    } \
  |  |  |  |  |  |  |  |   66|  27.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  27.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  27.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  27.4k|{ \
  |  |  |  |  |  |  |  |  128|  44.7k|    do { \
  |  |  |  |  |  |  |  |  129|  44.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.71k, False: 38.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.71k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.71k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.71k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.71k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.71k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.71k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.71k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.71k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.56k, False: 154]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.56k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.55k, False: 12]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.55k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.55k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.55k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.55k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     12|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     12|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     12|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     12|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.56k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    154|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    154|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    154|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    154|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.71k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.71k|        } \
  |  |  |  |  |  |  |  |  132|  44.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  44.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  44.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  44.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 17.2k, False: 27.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  27.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  85.2k|    } else {  \
  |  |  |  |  |  |  149|  85.2k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  85.2k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 39.6k, False: 45.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  39.6k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  39.6k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  39.6k|{ \
  |  |  |  |  |  |  |  |   45|  39.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 3.57k, False: 36.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  3.57k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  3.57k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  36.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  36.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  36.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  36.0k|    } \
  |  |  |  |  |  |  |  |   52|  39.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  39.6k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  39.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  39.6k|{ \
  |  |  |  |  |  |  |  |  128|  41.6k|    do { \
  |  |  |  |  |  |  |  |  129|  41.6k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.73k, False: 36.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.73k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.73k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.73k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.73k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.73k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.73k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.73k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.73k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.40k, False: 334]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.40k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.39k, False: 13]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.39k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.39k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.39k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.39k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     13|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     13|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     13|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     13|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.40k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    334|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    334|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    334|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    334|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.73k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.73k|        } \
  |  |  |  |  |  |  |  |  132|  41.6k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  41.6k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  41.6k|        ct--; \
  |  |  |  |  |  |  |  |  135|  41.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.08k, False: 39.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  39.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  45.6k|        } else { \
  |  |  |  |  |  |  154|  45.6k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  45.6k|        } \
  |  |  |  |  |  |  156|  85.2k|    } \
  |  |  |  |  |  |  157|   112k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   112k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   112k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 54.5k, False: 58.2k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   112k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   112k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   112k|{ \
  |  |  |  |  |  |  326|   112k|    /* east */ \
  |  |  |  |  |  |  327|   112k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   112k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   112k| \
  |  |  |  |  |  |  329|   112k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   112k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   112k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   112k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   112k| \
  |  |  |  |  |  |  332|   112k|    /* west */ \
  |  |  |  |  |  |  333|   112k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   112k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   112k| \
  |  |  |  |  |  |  335|   112k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   112k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   112k| \
  |  |  |  |  |  |  343|   112k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   112k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   112k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   112k|            } \
  |  |  |  | 1142|   112k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   174k|    } \
  |  |  |  | 1144|   174k|}
  |  |  ------------------
  |  | 1299|   174k|                                            flags, flagsp, flags_stride, data, \
  |  | 1300|   174k|                                            l_w, 2, mqc, curctx, \
  |  | 1301|   174k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1302|   174k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   174k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1303|   174k|                        /* FALLTHRU */ \
  |  | 1304|   218k|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1304:21): [True: 43.7k, False: 174k]
  |  |  ------------------
  |  | 1305|   218k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|   218k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|   218k|{ \
  |  |  |  | 1123|   218k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|   218k|        do { \
  |  |  |  | 1125|   218k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 174k, False: 43.7k]
  |  |  |  |  ------------------
  |  |  |  | 1126|   174k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   174k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   174k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   174k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   174k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   174k|{ \
  |  |  |  |  |  |  140|   174k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   174k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   174k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   174k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   174k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   174k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 25.5k, False: 149k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  25.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  25.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  25.5k|{ \
  |  |  |  |  |  |  |  |   57|  25.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 5.11k, False: 20.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  5.11k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  5.11k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  5.11k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  20.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  20.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  20.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  20.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  20.4k|    } \
  |  |  |  |  |  |  |  |   66|  25.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  25.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  25.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  25.5k|{ \
  |  |  |  |  |  |  |  |  128|  44.8k|    do { \
  |  |  |  |  |  |  |  |  129|  44.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.29k, False: 39.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.29k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.29k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.29k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.29k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.29k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.29k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.29k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.29k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.67k, False: 615]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.67k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.66k, False: 10]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.66k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.66k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.66k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.66k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     10|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     10|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     10|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     10|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.67k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    615|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    615|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    615|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    615|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.29k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.29k|        } \
  |  |  |  |  |  |  |  |  132|  44.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  44.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  44.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  44.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 19.2k, False: 25.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  25.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   149k|    } else {  \
  |  |  |  |  |  |  149|   149k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   149k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 31.7k, False: 117k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  31.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  31.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  31.7k|{ \
  |  |  |  |  |  |  |  |   45|  31.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.90k, False: 26.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.90k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.90k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  26.8k|    } else { \
  |  |  |  |  |  |  |  |   49|  26.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  26.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  26.8k|    } \
  |  |  |  |  |  |  |  |   52|  31.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  31.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  31.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  31.7k|{ \
  |  |  |  |  |  |  |  |  128|  33.9k|    do { \
  |  |  |  |  |  |  |  |  129|  33.9k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.56k, False: 27.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.56k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.56k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.56k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.56k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.56k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.56k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.56k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.56k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.04k, False: 518]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.04k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.02k, False: 16]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.02k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.02k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.02k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.02k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     16|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     16|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     16|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     16|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.04k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    518|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    518|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    518|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    518|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.56k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.56k|        } \
  |  |  |  |  |  |  |  |  132|  33.9k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  33.9k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  33.9k|        ct--; \
  |  |  |  |  |  |  |  |  135|  33.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.19k, False: 31.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  31.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   117k|        } else { \
  |  |  |  |  |  |  154|   117k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   117k|        } \
  |  |  |  |  |  |  156|   149k|    } \
  |  |  |  |  |  |  157|   174k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   174k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 93.4k, False: 81.2k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   174k|                    break; \
  |  |  |  | 1131|   174k|            } \
  |  |  |  | 1132|   218k|            { \
  |  |  |  | 1133|   125k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   125k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   125k|                                    ci); \
  |  |  |  | 1136|   125k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   125k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   125k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   125k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   125k|{ \
  |  |  |  |  |  |  140|   125k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   125k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   125k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   125k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   125k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   125k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 33.9k, False: 91.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  33.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  33.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  33.9k|{ \
  |  |  |  |  |  |  |  |   57|  33.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 6.18k, False: 27.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  6.18k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  6.18k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  6.18k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  27.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  27.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  27.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  27.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  27.8k|    } \
  |  |  |  |  |  |  |  |   66|  33.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  33.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  33.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  33.9k|{ \
  |  |  |  |  |  |  |  |  128|  55.3k|    do { \
  |  |  |  |  |  |  |  |  129|  55.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.78k, False: 50.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.78k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.78k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.78k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.78k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.78k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.78k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.78k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.78k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.66k, False: 121]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.66k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.65k, False: 10]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.65k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.65k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.65k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.65k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     10|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     10|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     10|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     10|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.66k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    121|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    121|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    121|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    121|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.78k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.78k|        } \
  |  |  |  |  |  |  |  |  132|  55.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  55.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  55.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  55.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 21.3k, False: 33.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  33.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  91.0k|    } else {  \
  |  |  |  |  |  |  149|  91.0k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  91.0k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 36.1k, False: 54.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  36.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  36.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  36.1k|{ \
  |  |  |  |  |  |  |  |   45|  36.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 3.62k, False: 32.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  3.62k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  3.62k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  32.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  32.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  32.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  32.4k|    } \
  |  |  |  |  |  |  |  |   52|  36.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  36.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  36.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  36.1k|{ \
  |  |  |  |  |  |  |  |  128|  37.4k|    do { \
  |  |  |  |  |  |  |  |  129|  37.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.44k, False: 32.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.44k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.44k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.44k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.44k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.44k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.44k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.44k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.44k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.31k, False: 135]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.31k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.30k, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.30k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.30k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.30k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.30k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      6|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      6|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      6|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      6|            } \
  |  |  |  |  |  |  |  |  |  |  118|  5.31k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    135|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    135|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    135|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    135|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.44k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.44k|        } \
  |  |  |  |  |  |  |  |  132|  37.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  37.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  37.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  37.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.37k, False: 36.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  36.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  54.9k|        } else { \
  |  |  |  |  |  |  154|  54.9k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  54.9k|        } \
  |  |  |  |  |  |  156|  91.0k|    } \
  |  |  |  |  |  |  157|   125k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   125k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   125k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 58.7k, False: 66.2k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   125k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   125k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   125k|{ \
  |  |  |  |  |  |  326|   125k|    /* east */ \
  |  |  |  |  |  |  327|   125k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   125k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   125k| \
  |  |  |  |  |  |  329|   125k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   125k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   125k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   125k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   125k| \
  |  |  |  |  |  |  332|   125k|    /* west */ \
  |  |  |  |  |  |  333|   125k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   125k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   125k| \
  |  |  |  |  |  |  335|   125k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   125k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   125k| \
  |  |  |  |  |  |  343|   125k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   125k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   125k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   125k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   125k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   125k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   125k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   125k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   125k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   125k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   125k|    } \
  |  |  |  |  |  |  350|   125k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   125k|            } \
  |  |  |  | 1142|   125k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   218k|    } \
  |  |  |  | 1144|   218k|}
  |  |  ------------------
  |  | 1306|   218k|                                            flags, flagsp, flags_stride, data, \
  |  | 1307|   218k|                                            l_w, 3, mqc, curctx, \
  |  | 1308|   218k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1309|   218k|                        break; \
  |  | 1310|   218k|                } \
  |  | 1311|  2.64M|            } else { \
  |  | 1312|  2.64M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.64M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.64M|{ \
  |  |  |  | 1123|  2.64M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.64M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.64M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.64M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.64M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 1.24M, False: 1.39M]
  |  |  |  |  ------------------
  |  |  |  | 1124|  1.24M|        do { \
  |  |  |  | 1125|  1.24M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  1.24M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  1.24M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.24M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.24M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.24M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.24M|{ \
  |  |  |  |  |  |  140|  1.24M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.24M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.24M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.24M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.24M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.24M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 251k, False: 993k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   251k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   251k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   251k|{ \
  |  |  |  |  |  |  |  |   57|   251k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 48.6k, False: 203k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  48.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  48.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  48.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   203k|    } else { \
  |  |  |  |  |  |  |  |   62|   203k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   203k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   203k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   203k|    } \
  |  |  |  |  |  |  |  |   66|   251k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   251k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   251k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   251k|{ \
  |  |  |  |  |  |  |  |  128|   429k|    do { \
  |  |  |  |  |  |  |  |  129|   429k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 49.6k, False: 380k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  49.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  49.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  49.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  49.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  49.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  49.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  49.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  49.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 47.8k, False: 1.78k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  47.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 47.6k, False: 189]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  47.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  47.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  47.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  47.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    189|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    189|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    189|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    189|            } \
  |  |  |  |  |  |  |  |  |  |  118|  47.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.78k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.78k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.78k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.78k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  49.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  49.6k|        } \
  |  |  |  |  |  |  |  |  132|   429k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   429k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   429k|        ct--; \
  |  |  |  |  |  |  |  |  135|   429k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 178k, False: 251k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   251k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   993k|    } else {  \
  |  |  |  |  |  |  149|   993k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   993k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 274k, False: 718k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   274k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   274k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   274k|{ \
  |  |  |  |  |  |  |  |   45|   274k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 41.1k, False: 233k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  41.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  41.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   233k|    } else { \
  |  |  |  |  |  |  |  |   49|   233k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   233k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   233k|    } \
  |  |  |  |  |  |  |  |   52|   274k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   274k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   274k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   274k|{ \
  |  |  |  |  |  |  |  |  128|   294k|    do { \
  |  |  |  |  |  |  |  |  129|   294k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 38.8k, False: 255k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  38.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  38.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  38.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  38.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  38.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  38.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  38.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  38.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 37.5k, False: 1.30k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  37.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 37.3k, False: 163]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  37.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  37.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  37.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  37.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    163|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    163|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    163|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    163|            } \
  |  |  |  |  |  |  |  |  |  |  118|  37.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.30k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.30k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.30k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.30k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  38.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  38.8k|        } \
  |  |  |  |  |  |  |  |  132|   294k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   294k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   294k|        ct--; \
  |  |  |  |  |  |  |  |  135|   294k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 19.5k, False: 274k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   274k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   718k|        } else { \
  |  |  |  |  |  |  154|   718k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   718k|        } \
  |  |  |  |  |  |  156|   993k|    } \
  |  |  |  |  |  |  157|  1.24M|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  1.24M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 734k, False: 510k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  1.24M|                    break; \
  |  |  |  | 1131|  1.24M|            } \
  |  |  |  | 1132|  1.24M|            { \
  |  |  |  | 1133|   510k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   510k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   510k|                                    ci); \
  |  |  |  | 1136|   510k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   510k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   510k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   510k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   510k|{ \
  |  |  |  |  |  |  140|   510k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   510k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   510k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   510k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   510k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   510k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 130k, False: 379k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   130k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   130k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   130k|{ \
  |  |  |  |  |  |  |  |   57|   130k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 28.3k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  28.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  28.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  28.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   102k|    } else { \
  |  |  |  |  |  |  |  |   62|   102k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   102k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   102k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   102k|    } \
  |  |  |  |  |  |  |  |   66|   130k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   130k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   130k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   130k|{ \
  |  |  |  |  |  |  |  |  128|   207k|    do { \
  |  |  |  |  |  |  |  |  129|   207k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 26.5k, False: 181k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  26.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  26.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  26.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  26.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  26.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  26.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  26.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  26.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 25.7k, False: 773]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  25.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 25.6k, False: 98]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  25.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  25.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  25.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  25.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     98|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     98|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     98|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     98|            } \
  |  |  |  |  |  |  |  |  |  |  118|  25.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    773|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    773|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    773|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    773|        } \
  |  |  |  |  |  |  |  |  |  |  123|  26.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  26.5k|        } \
  |  |  |  |  |  |  |  |  132|   207k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   207k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   207k|        ct--; \
  |  |  |  |  |  |  |  |  135|   207k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 77.3k, False: 130k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   130k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   379k|    } else {  \
  |  |  |  |  |  |  149|   379k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   379k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 143k, False: 235k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   143k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   143k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   143k|{ \
  |  |  |  |  |  |  |  |   45|   143k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 22.7k, False: 121k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  22.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  22.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   121k|    } else { \
  |  |  |  |  |  |  |  |   49|   121k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   121k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   121k|    } \
  |  |  |  |  |  |  |  |   52|   143k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   143k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   143k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   143k|{ \
  |  |  |  |  |  |  |  |  128|   154k|    do { \
  |  |  |  |  |  |  |  |  129|   154k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.1k, False: 135k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 18.4k, False: 676]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  18.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 18.3k, False: 52]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  18.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  18.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  18.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  18.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     52|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     52|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     52|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     52|            } \
  |  |  |  |  |  |  |  |  |  |  118|  18.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    676|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    676|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    676|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    676|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.1k|        } \
  |  |  |  |  |  |  |  |  132|   154k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   154k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   154k|        ct--; \
  |  |  |  |  |  |  |  |  135|   154k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 10.3k, False: 143k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   143k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   235k|        } else { \
  |  |  |  |  |  |  154|   235k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   235k|        } \
  |  |  |  |  |  |  156|   379k|    } \
  |  |  |  |  |  |  157|   510k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   510k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   510k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 243k, False: 266k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   510k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   510k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   510k|{ \
  |  |  |  |  |  |  326|   510k|    /* east */ \
  |  |  |  |  |  |  327|   510k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   510k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   510k| \
  |  |  |  |  |  |  329|   510k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   510k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   510k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   510k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   510k| \
  |  |  |  |  |  |  332|   510k|    /* west */ \
  |  |  |  |  |  |  333|   510k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   510k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   510k| \
  |  |  |  |  |  |  335|   510k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   510k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   510k| \
  |  |  |  |  |  |  343|   510k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   510k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   510k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   510k|            } \
  |  |  |  | 1142|   510k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  1.24M|    } \
  |  |  |  | 1144|  2.64M|}
  |  |  ------------------
  |  | 1313|  2.64M|                                    flags, flagsp, flags_stride, data, \
  |  | 1314|  2.64M|                                    l_w, 0, mqc, curctx, \
  |  | 1315|  2.64M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1316|  2.64M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.64M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.64M|{ \
  |  |  |  | 1123|  2.64M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.64M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.64M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.64M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.64M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 1.22M, False: 1.41M]
  |  |  |  |  ------------------
  |  |  |  | 1124|  1.22M|        do { \
  |  |  |  | 1125|  1.22M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  1.22M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  1.22M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.22M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.22M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.22M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.22M|{ \
  |  |  |  |  |  |  140|  1.22M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.22M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.22M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.22M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.22M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.22M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 285k, False: 943k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   285k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   285k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   285k|{ \
  |  |  |  |  |  |  |  |   57|   285k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 63.2k, False: 221k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  63.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  63.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  63.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   221k|    } else { \
  |  |  |  |  |  |  |  |   62|   221k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   221k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   221k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   221k|    } \
  |  |  |  |  |  |  |  |   66|   285k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   285k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   285k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   285k|{ \
  |  |  |  |  |  |  |  |  128|   461k|    do { \
  |  |  |  |  |  |  |  |  129|   461k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 56.1k, False: 405k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  56.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  56.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  56.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  56.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  56.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  56.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  56.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  56.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 53.4k, False: 2.74k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  53.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 53.2k, False: 134]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  53.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  53.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  53.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  53.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    134|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    134|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    134|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    134|            } \
  |  |  |  |  |  |  |  |  |  |  118|  53.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.74k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.74k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.74k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.74k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  56.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  56.1k|        } \
  |  |  |  |  |  |  |  |  132|   461k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   461k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   461k|        ct--; \
  |  |  |  |  |  |  |  |  135|   461k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 176k, False: 285k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   285k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   943k|    } else {  \
  |  |  |  |  |  |  149|   943k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   943k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 292k, False: 651k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   292k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   292k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   292k|{ \
  |  |  |  |  |  |  |  |   45|   292k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 46.3k, False: 246k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  46.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  46.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   246k|    } else { \
  |  |  |  |  |  |  |  |   49|   246k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   246k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   246k|    } \
  |  |  |  |  |  |  |  |   52|   292k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   292k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   292k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   292k|{ \
  |  |  |  |  |  |  |  |  128|   315k|    do { \
  |  |  |  |  |  |  |  |  129|   315k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 37.6k, False: 277k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  37.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  37.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  37.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  37.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  37.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  37.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  37.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  37.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 36.6k, False: 1.01k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  36.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 36.4k, False: 120]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  36.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  36.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  36.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  36.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    120|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    120|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    120|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    120|            } \
  |  |  |  |  |  |  |  |  |  |  118|  36.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.01k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.01k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.01k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.01k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  37.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  37.6k|        } \
  |  |  |  |  |  |  |  |  132|   315k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   315k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   315k|        ct--; \
  |  |  |  |  |  |  |  |  135|   315k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 22.7k, False: 292k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   292k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   651k|        } else { \
  |  |  |  |  |  |  154|   651k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   651k|        } \
  |  |  |  |  |  |  156|   943k|    } \
  |  |  |  |  |  |  157|  1.22M|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  1.22M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 721k, False: 507k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  1.22M|                    break; \
  |  |  |  | 1131|  1.22M|            } \
  |  |  |  | 1132|  1.22M|            { \
  |  |  |  | 1133|   507k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   507k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   507k|                                    ci); \
  |  |  |  | 1136|   507k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   507k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   507k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   507k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   507k|{ \
  |  |  |  |  |  |  140|   507k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   507k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   507k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   507k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   507k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   507k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 140k, False: 366k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   140k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   140k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   140k|{ \
  |  |  |  |  |  |  |  |   57|   140k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 27.8k, False: 112k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  27.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  27.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  27.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   112k|    } else { \
  |  |  |  |  |  |  |  |   62|   112k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   112k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   112k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   112k|    } \
  |  |  |  |  |  |  |  |   66|   140k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   140k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   140k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   140k|{ \
  |  |  |  |  |  |  |  |  128|   224k|    do { \
  |  |  |  |  |  |  |  |  129|   224k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 31.5k, False: 192k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  31.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  31.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  31.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  31.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  31.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  31.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  31.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  31.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 30.3k, False: 1.13k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  30.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 30.1k, False: 179]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  30.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  30.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  30.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  30.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    179|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    179|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    179|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    179|            } \
  |  |  |  |  |  |  |  |  |  |  118|  30.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.13k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.13k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.13k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.13k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  31.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  31.5k|        } \
  |  |  |  |  |  |  |  |  132|   224k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   224k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   224k|        ct--; \
  |  |  |  |  |  |  |  |  135|   224k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 83.9k, False: 140k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   140k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   366k|    } else {  \
  |  |  |  |  |  |  149|   366k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   366k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 144k, False: 222k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   144k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   144k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   144k|{ \
  |  |  |  |  |  |  |  |   45|   144k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 23.1k, False: 121k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  23.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  23.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   121k|    } else { \
  |  |  |  |  |  |  |  |   49|   121k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   121k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   121k|    } \
  |  |  |  |  |  |  |  |   52|   144k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   144k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   144k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   144k|{ \
  |  |  |  |  |  |  |  |  128|   154k|    do { \
  |  |  |  |  |  |  |  |  129|   154k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.8k, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 19.3k, False: 486]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  19.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19.3k, False: 78]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  19.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  19.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  19.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  19.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     78|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     78|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     78|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     78|            } \
  |  |  |  |  |  |  |  |  |  |  118|  19.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    486|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    486|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    486|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    486|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.8k|        } \
  |  |  |  |  |  |  |  |  132|   154k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   154k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   154k|        ct--; \
  |  |  |  |  |  |  |  |  135|   154k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9.86k, False: 144k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   144k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   222k|        } else { \
  |  |  |  |  |  |  154|   222k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   222k|        } \
  |  |  |  |  |  |  156|   366k|    } \
  |  |  |  |  |  |  157|   507k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   507k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   507k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 247k, False: 259k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   507k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   507k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   507k|{ \
  |  |  |  |  |  |  326|   507k|    /* east */ \
  |  |  |  |  |  |  327|   507k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   507k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   507k| \
  |  |  |  |  |  |  329|   507k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   507k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   507k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   507k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   507k| \
  |  |  |  |  |  |  332|   507k|    /* west */ \
  |  |  |  |  |  |  333|   507k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   507k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   507k| \
  |  |  |  |  |  |  335|   507k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   507k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   507k| \
  |  |  |  |  |  |  343|   507k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   507k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   507k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   507k|            } \
  |  |  |  | 1142|   507k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  1.22M|    } \
  |  |  |  | 1144|  2.64M|}
  |  |  ------------------
  |  | 1317|  2.64M|                                    flags, flagsp, flags_stride, data, \
  |  | 1318|  2.64M|                                    l_w, 1, mqc, curctx, \
  |  | 1319|  2.64M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1320|  2.64M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.64M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.64M|{ \
  |  |  |  | 1123|  2.64M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.64M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.64M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.64M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.64M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 1.22M, False: 1.41M]
  |  |  |  |  ------------------
  |  |  |  | 1124|  1.22M|        do { \
  |  |  |  | 1125|  1.22M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  1.22M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  1.22M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.22M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.22M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.22M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.22M|{ \
  |  |  |  |  |  |  140|  1.22M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.22M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.22M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.22M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.22M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.22M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 272k, False: 953k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   272k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   272k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   272k|{ \
  |  |  |  |  |  |  |  |   57|   272k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 58.3k, False: 214k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  58.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  58.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  58.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   214k|    } else { \
  |  |  |  |  |  |  |  |   62|   214k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   214k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   214k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   214k|    } \
  |  |  |  |  |  |  |  |   66|   272k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   272k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   272k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   272k|{ \
  |  |  |  |  |  |  |  |  128|   446k|    do { \
  |  |  |  |  |  |  |  |  129|   446k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 57.5k, False: 389k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  57.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  57.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  57.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  57.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  57.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  57.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  57.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  57.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 55.7k, False: 1.72k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  55.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 55.6k, False: 157]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  55.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  55.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  55.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  55.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    157|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    157|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    157|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    157|            } \
  |  |  |  |  |  |  |  |  |  |  118|  55.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.72k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.72k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.72k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.72k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  57.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  57.5k|        } \
  |  |  |  |  |  |  |  |  132|   446k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   446k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   446k|        ct--; \
  |  |  |  |  |  |  |  |  135|   446k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 173k, False: 272k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   272k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   953k|    } else {  \
  |  |  |  |  |  |  149|   953k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   953k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 304k, False: 649k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   304k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   304k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   304k|{ \
  |  |  |  |  |  |  |  |   45|   304k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 46.5k, False: 257k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  46.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  46.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   257k|    } else { \
  |  |  |  |  |  |  |  |   49|   257k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   257k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   257k|    } \
  |  |  |  |  |  |  |  |   52|   304k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   304k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   304k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   304k|{ \
  |  |  |  |  |  |  |  |  128|   325k|    do { \
  |  |  |  |  |  |  |  |  129|   325k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 40.2k, False: 285k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  40.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  40.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  40.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  40.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  40.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  40.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  40.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  40.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 39.0k, False: 1.20k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  39.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 38.9k, False: 95]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  38.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  38.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  38.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  38.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     95|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     95|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     95|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     95|            } \
  |  |  |  |  |  |  |  |  |  |  118|  39.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.20k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.20k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.20k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.20k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  40.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  40.2k|        } \
  |  |  |  |  |  |  |  |  132|   325k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   325k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   325k|        ct--; \
  |  |  |  |  |  |  |  |  135|   325k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 21.2k, False: 304k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   304k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   649k|        } else { \
  |  |  |  |  |  |  154|   649k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   649k|        } \
  |  |  |  |  |  |  156|   953k|    } \
  |  |  |  |  |  |  157|  1.22M|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  1.22M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 682k, False: 543k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  1.22M|                    break; \
  |  |  |  | 1131|  1.22M|            } \
  |  |  |  | 1132|  1.22M|            { \
  |  |  |  | 1133|   543k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   543k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   543k|                                    ci); \
  |  |  |  | 1136|   543k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   543k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   543k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   543k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   543k|{ \
  |  |  |  |  |  |  140|   543k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   543k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   543k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   543k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   543k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   543k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 143k, False: 399k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   143k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   143k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   143k|{ \
  |  |  |  |  |  |  |  |   57|   143k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 31.9k, False: 111k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  31.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  31.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  31.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   111k|    } else { \
  |  |  |  |  |  |  |  |   62|   111k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   111k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   111k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   111k|    } \
  |  |  |  |  |  |  |  |   66|   143k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   143k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   143k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   143k|{ \
  |  |  |  |  |  |  |  |  128|   228k|    do { \
  |  |  |  |  |  |  |  |  129|   228k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 28.5k, False: 199k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  28.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  28.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  28.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  28.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  28.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  28.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  28.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  28.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 27.4k, False: 1.11k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  27.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 27.3k, False: 87]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  27.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  27.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  27.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  27.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     87|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     87|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     87|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     87|            } \
  |  |  |  |  |  |  |  |  |  |  118|  27.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.11k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.11k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.11k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.11k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  28.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  28.5k|        } \
  |  |  |  |  |  |  |  |  132|   228k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   228k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   228k|        ct--; \
  |  |  |  |  |  |  |  |  135|   228k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 84.4k, False: 143k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   143k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   399k|    } else {  \
  |  |  |  |  |  |  149|   399k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   399k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 156k, False: 243k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   156k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   156k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   156k|{ \
  |  |  |  |  |  |  |  |   45|   156k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 26.8k, False: 129k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  26.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  26.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   129k|    } else { \
  |  |  |  |  |  |  |  |   49|   129k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   129k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   129k|    } \
  |  |  |  |  |  |  |  |   52|   156k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   156k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   156k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   156k|{ \
  |  |  |  |  |  |  |  |  128|   168k|    do { \
  |  |  |  |  |  |  |  |  129|   168k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 23.2k, False: 145k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  23.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  23.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  23.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  23.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  23.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  23.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  23.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  23.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 22.7k, False: 575]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  22.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 22.6k, False: 71]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  22.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  22.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  22.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  22.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     71|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     71|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     71|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     71|            } \
  |  |  |  |  |  |  |  |  |  |  118|  22.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    575|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    575|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    575|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    575|        } \
  |  |  |  |  |  |  |  |  |  |  123|  23.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  23.2k|        } \
  |  |  |  |  |  |  |  |  132|   168k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   168k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   168k|        ct--; \
  |  |  |  |  |  |  |  |  135|   168k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.8k, False: 156k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   156k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   243k|        } else { \
  |  |  |  |  |  |  154|   243k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   243k|        } \
  |  |  |  |  |  |  156|   399k|    } \
  |  |  |  |  |  |  157|   543k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   543k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   543k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 268k, False: 274k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   543k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   543k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   543k|{ \
  |  |  |  |  |  |  326|   543k|    /* east */ \
  |  |  |  |  |  |  327|   543k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   543k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   543k| \
  |  |  |  |  |  |  329|   543k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   543k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   543k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   543k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   543k| \
  |  |  |  |  |  |  332|   543k|    /* west */ \
  |  |  |  |  |  |  333|   543k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   543k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   543k| \
  |  |  |  |  |  |  335|   543k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   543k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   543k| \
  |  |  |  |  |  |  343|   543k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   543k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   543k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   543k|            } \
  |  |  |  | 1142|   543k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  1.22M|    } \
  |  |  |  | 1144|  2.64M|}
  |  |  ------------------
  |  | 1321|  2.64M|                                    flags, flagsp, flags_stride, data, \
  |  | 1322|  2.64M|                                    l_w, 2, mqc, curctx, \
  |  | 1323|  2.64M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1324|  2.64M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.64M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.64M|{ \
  |  |  |  | 1123|  2.64M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.64M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.64M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.64M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.64M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 1.23M, False: 1.40M]
  |  |  |  |  ------------------
  |  |  |  | 1124|  1.23M|        do { \
  |  |  |  | 1125|  1.23M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  1.23M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  1.23M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.23M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  1.23M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.23M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.23M|{ \
  |  |  |  |  |  |  140|  1.23M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.23M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.23M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.23M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.23M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.23M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 258k, False: 980k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   258k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   258k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   258k|{ \
  |  |  |  |  |  |  |  |   57|   258k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 50.0k, False: 208k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  50.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  50.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  50.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   208k|    } else { \
  |  |  |  |  |  |  |  |   62|   208k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   208k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   208k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   208k|    } \
  |  |  |  |  |  |  |  |   66|   258k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   258k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   258k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   258k|{ \
  |  |  |  |  |  |  |  |  128|   432k|    do { \
  |  |  |  |  |  |  |  |  129|   432k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 52.0k, False: 380k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  52.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  52.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  52.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  52.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  52.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  52.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  52.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  52.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 50.6k, False: 1.39k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  50.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 50.5k, False: 136]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  50.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  50.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  50.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  50.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    136|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    136|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    136|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    136|            } \
  |  |  |  |  |  |  |  |  |  |  118|  50.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.39k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.39k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.39k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.39k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  52.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  52.0k|        } \
  |  |  |  |  |  |  |  |  132|   432k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   432k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   432k|        ct--; \
  |  |  |  |  |  |  |  |  135|   432k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 174k, False: 258k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   258k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   980k|    } else {  \
  |  |  |  |  |  |  149|   980k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   980k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 286k, False: 693k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   286k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   286k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   286k|{ \
  |  |  |  |  |  |  |  |   45|   286k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 44.9k, False: 241k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  44.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  44.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   241k|    } else { \
  |  |  |  |  |  |  |  |   49|   241k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   241k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   241k|    } \
  |  |  |  |  |  |  |  |   52|   286k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   286k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   286k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   286k|{ \
  |  |  |  |  |  |  |  |  128|   307k|    do { \
  |  |  |  |  |  |  |  |  129|   307k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 35.9k, False: 271k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  35.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  35.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  35.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  35.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  35.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  35.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  35.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  35.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 35.1k, False: 754]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  35.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 35.0k, False: 89]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  35.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  35.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  35.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  35.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     89|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     89|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     89|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     89|            } \
  |  |  |  |  |  |  |  |  |  |  118|  35.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    754|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    754|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    754|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    754|        } \
  |  |  |  |  |  |  |  |  |  |  123|  35.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  35.9k|        } \
  |  |  |  |  |  |  |  |  132|   307k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   307k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   307k|        ct--; \
  |  |  |  |  |  |  |  |  135|   307k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 20.5k, False: 286k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   286k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   693k|        } else { \
  |  |  |  |  |  |  154|   693k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   693k|        } \
  |  |  |  |  |  |  156|   980k|    } \
  |  |  |  |  |  |  157|  1.23M|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  1.23M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 729k, False: 509k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  1.23M|                    break; \
  |  |  |  | 1131|  1.23M|            } \
  |  |  |  | 1132|  1.23M|            { \
  |  |  |  | 1133|   509k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   509k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   509k|                                    ci); \
  |  |  |  | 1136|   509k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   509k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   509k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   509k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   509k|{ \
  |  |  |  |  |  |  140|   509k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   509k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   509k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   509k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   509k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   509k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 145k, False: 363k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   145k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   145k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   145k|{ \
  |  |  |  |  |  |  |  |   57|   145k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 32.1k, False: 113k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  32.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  32.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  32.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   113k|    } else { \
  |  |  |  |  |  |  |  |   62|   113k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   113k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   113k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   113k|    } \
  |  |  |  |  |  |  |  |   66|   145k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   145k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   145k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   145k|{ \
  |  |  |  |  |  |  |  |  128|   230k|    do { \
  |  |  |  |  |  |  |  |  129|   230k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 27.4k, False: 203k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  27.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  27.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  27.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  27.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  27.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  27.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  27.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  27.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 26.0k, False: 1.43k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  26.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 26.0k, False: 60]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  26.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  26.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  26.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  26.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     60|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     60|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     60|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     60|            } \
  |  |  |  |  |  |  |  |  |  |  118|  26.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.43k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.43k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.43k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.43k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  27.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  27.4k|        } \
  |  |  |  |  |  |  |  |  132|   230k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   230k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   230k|        ct--; \
  |  |  |  |  |  |  |  |  135|   230k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 85.2k, False: 145k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   145k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   363k|    } else {  \
  |  |  |  |  |  |  149|   363k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   363k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 143k, False: 220k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   143k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   143k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   143k|{ \
  |  |  |  |  |  |  |  |   45|   143k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 22.7k, False: 120k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  22.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  22.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   120k|    } else { \
  |  |  |  |  |  |  |  |   49|   120k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   120k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   120k|    } \
  |  |  |  |  |  |  |  |   52|   143k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   143k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   143k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   143k|{ \
  |  |  |  |  |  |  |  |  128|   153k|    do { \
  |  |  |  |  |  |  |  |  129|   153k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.6k, False: 133k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 19.0k, False: 629]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  19.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 18.9k, False: 71]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  18.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  18.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  18.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  18.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     71|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     71|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     71|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     71|            } \
  |  |  |  |  |  |  |  |  |  |  118|  19.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    629|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    629|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    629|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    629|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.6k|        } \
  |  |  |  |  |  |  |  |  132|   153k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   153k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   153k|        ct--; \
  |  |  |  |  |  |  |  |  135|   153k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 10.5k, False: 143k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   143k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   220k|        } else { \
  |  |  |  |  |  |  154|   220k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   220k|        } \
  |  |  |  |  |  |  156|   363k|    } \
  |  |  |  |  |  |  157|   509k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   509k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   509k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 246k, False: 263k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   509k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   509k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   509k|{ \
  |  |  |  |  |  |  326|   509k|    /* east */ \
  |  |  |  |  |  |  327|   509k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   509k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   509k| \
  |  |  |  |  |  |  329|   509k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   509k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   509k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   509k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   509k| \
  |  |  |  |  |  |  332|   509k|    /* west */ \
  |  |  |  |  |  |  333|   509k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   509k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   509k| \
  |  |  |  |  |  |  335|   509k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   509k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   509k| \
  |  |  |  |  |  |  343|   509k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   509k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   509k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   509k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   509k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   509k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   509k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   509k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   509k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   509k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   509k|    } \
  |  |  |  |  |  |  350|   509k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   509k|            } \
  |  |  |  | 1142|   509k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  1.23M|    } \
  |  |  |  | 1144|  2.64M|}
  |  |  ------------------
  |  | 1325|  2.64M|                                    flags, flagsp, flags_stride, data, \
  |  | 1326|  2.64M|                                    l_w, 3, mqc, curctx, \
  |  | 1327|  2.64M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1328|  2.64M|            } \
  |  | 1329|  4.03M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  2.86M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  2.86M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  2.86M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  2.86M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1330|  2.86M|        } \
  |  | 1331|  57.6k|    } \
  |  | 1332|  10.3k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  10.3k|        mqc->curctx = curctx; \
  |  |  |  |  167|  10.3k|        mqc->c = c; \
  |  |  |  |  168|  10.3k|        mqc->a = a; \
  |  |  |  |  169|  10.3k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1333|  10.3k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1333:9): [True: 2.80k, False: 7.49k]
  |  |  ------------------
  |  | 1334|   230k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1334:21): [True: 227k, False: 2.80k]
  |  |  ------------------
  |  | 1335|   743k|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1335:25): [True: 515k, False: 227k]
  |  |  ------------------
  |  | 1336|   515k|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1337|   515k|            } \
  |  | 1338|   227k|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|   227k|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|   227k|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|   227k|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|   227k|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1339|   227k|        } \
  |  | 1340|  2.80k|    } \
  |  | 1341|  10.3k|}
  ------------------
 1391|  10.3k|                                t1->w + 2U);
 1392|  10.3k|}
t1.c:opj_t1_dec_clnpass_generic_novsc:
 1381|  17.8k|{
 1382|  17.8k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_FALSE, t1->w, t1->h,
  ------------------
  |  | 1254|  17.8k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1255|  17.8k|{ \
  |  | 1256|  17.8k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1257|  17.8k|    OPJ_UINT32 runlen; \
  |  | 1258|  17.8k|    OPJ_UINT32 i, j, k; \
  |  | 1259|  17.8k|    const OPJ_UINT32 l_w = w; \
  |  | 1260|  17.8k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1261|  17.8k|    register OPJ_INT32 *data = t1->data; \
  |  | 1262|  17.8k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1263|  17.8k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  17.8k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  17.8k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  17.8k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  17.8k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1264|  17.8k|    register OPJ_UINT32 v; \
  |  | 1265|  17.8k|    one = 1 << bpno; \
  |  | 1266|  17.8k|    half = one >> 1; \
  |  | 1267|  17.8k|    oneplushalf = one | half; \
  |  | 1268|   108k|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 90.2k, False: 17.8k]
  |  |  ------------------
  |  | 1269|  3.90M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1269:21): [True: 3.81M, False: 90.2k]
  |  |  ------------------
  |  | 1270|  3.81M|            opj_flag_t flags = *flagsp; \
  |  | 1271|  3.81M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1271:17): [True: 1.45M, False: 2.36M]
  |  |  ------------------
  |  | 1272|  1.45M|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  1.45M|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1273|  1.45M|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   65|  1.45M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1274|  1.45M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  1.45M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  1.45M|{ \
  |  |  |  |  140|  1.45M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  1.45M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  1.45M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  1.45M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  1.45M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  1.45M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 134k, False: 1.31M]
  |  |  |  |  ------------------
  |  |  |  |  146|   134k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   134k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   134k|{ \
  |  |  |  |  |  |   57|   134k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 13.4k, False: 121k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  13.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  13.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  13.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   121k|    } else { \
  |  |  |  |  |  |   62|   121k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   121k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   121k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   121k|    } \
  |  |  |  |  |  |   66|   134k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   134k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   134k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   134k|{ \
  |  |  |  |  |  |  128|   315k|    do { \
  |  |  |  |  |  |  129|   315k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 40.6k, False: 274k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  40.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  40.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  40.6k|{ \
  |  |  |  |  |  |  |  |  104|  40.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  40.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  40.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  40.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  40.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 24.2k, False: 16.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  24.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 23.9k, False: 278]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  23.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  23.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  23.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  23.9k|            } else { \
  |  |  |  |  |  |  |  |  114|    278|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    278|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    278|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    278|            } \
  |  |  |  |  |  |  |  |  118|  24.2k|        } else { \
  |  |  |  |  |  |  |  |  119|  16.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  16.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  16.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  16.4k|        } \
  |  |  |  |  |  |  |  |  123|  40.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  40.6k|        } \
  |  |  |  |  |  |  132|   315k|        a <<= 1; \
  |  |  |  |  |  |  133|   315k|        c <<= 1; \
  |  |  |  |  |  |  134|   315k|        ct--; \
  |  |  |  |  |  |  135|   315k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 180k, False: 134k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   134k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  1.31M|    } else {  \
  |  |  |  |  149|  1.31M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  1.31M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 160k, False: 1.15M]
  |  |  |  |  ------------------
  |  |  |  |  151|   160k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   160k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   160k|{ \
  |  |  |  |  |  |   45|   160k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 12.0k, False: 148k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  12.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  12.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   148k|    } else { \
  |  |  |  |  |  |   49|   148k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   148k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   148k|    } \
  |  |  |  |  |  |   52|   160k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   160k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   160k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   160k|{ \
  |  |  |  |  |  |  128|   166k|    do { \
  |  |  |  |  |  |  129|   166k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 23.4k, False: 142k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  23.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  23.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  23.4k|{ \
  |  |  |  |  |  |  |  |  104|  23.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  23.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  23.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  23.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  23.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16.3k, False: 7.04k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  16.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16.1k, False: 185]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  16.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  16.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  16.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  16.1k|            } else { \
  |  |  |  |  |  |  |  |  114|    185|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    185|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    185|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    185|            } \
  |  |  |  |  |  |  |  |  118|  16.3k|        } else { \
  |  |  |  |  |  |  |  |  119|  7.04k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  7.04k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  7.04k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  7.04k|        } \
  |  |  |  |  |  |  |  |  123|  23.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  23.4k|        } \
  |  |  |  |  |  |  132|   166k|        a <<= 1; \
  |  |  |  |  |  |  133|   166k|        c <<= 1; \
  |  |  |  |  |  |  134|   166k|        ct--; \
  |  |  |  |  |  |  135|   166k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 5.26k, False: 160k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   160k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  1.15M|        } else { \
  |  |  |  |  154|  1.15M|            d = (*curctx)->mps; \
  |  |  |  |  155|  1.15M|        } \
  |  |  |  |  156|  1.31M|    } \
  |  |  |  |  157|  1.45M|}
  |  |  ------------------
  |  | 1275|  1.45M|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1275:21): [True: 1.30M, False: 146k]
  |  |  ------------------
  |  | 1276|  1.30M|                    continue; \
  |  | 1277|  1.30M|                } \
  |  | 1278|  1.45M|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   65|   146k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1279|   146k|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   146k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   146k|{ \
  |  |  |  |  140|   146k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   146k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   146k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   146k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   146k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   146k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 72.1k, False: 74.5k]
  |  |  |  |  ------------------
  |  |  |  |  146|  72.1k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  72.1k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  72.1k|{ \
  |  |  |  |  |  |   57|  72.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 43.5k, False: 28.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  43.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  43.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  43.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  43.5k|    } else { \
  |  |  |  |  |  |   62|  28.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  28.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  28.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  28.6k|    } \
  |  |  |  |  |  |   66|  72.1k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  72.1k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  72.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  72.1k|{ \
  |  |  |  |  |  |  128|  72.1k|    do { \
  |  |  |  |  |  |  129|  72.1k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 9.28k, False: 62.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  9.28k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  9.28k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  9.28k|{ \
  |  |  |  |  |  |  |  |  104|  9.28k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  9.28k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  9.28k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  9.28k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  9.28k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.13k, False: 2.15k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  7.13k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.04k, False: 86]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  7.04k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  7.04k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  7.04k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  7.04k|            } else { \
  |  |  |  |  |  |  |  |  114|     86|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     86|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     86|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     86|            } \
  |  |  |  |  |  |  |  |  118|  7.13k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.15k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.15k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.15k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.15k|        } \
  |  |  |  |  |  |  |  |  123|  9.28k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  9.28k|        } \
  |  |  |  |  |  |  132|  72.1k|        a <<= 1; \
  |  |  |  |  |  |  133|  72.1k|        c <<= 1; \
  |  |  |  |  |  |  134|  72.1k|        ct--; \
  |  |  |  |  |  |  135|  72.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 72.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  72.1k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  74.5k|    } else {  \
  |  |  |  |  149|  74.5k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  74.5k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 62.6k, False: 11.8k]
  |  |  |  |  ------------------
  |  |  |  |  151|  62.6k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  62.6k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  62.6k|{ \
  |  |  |  |  |  |   45|  62.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 35.3k, False: 27.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  35.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  35.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  35.3k|    } else { \
  |  |  |  |  |  |   49|  27.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  27.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  27.3k|    } \
  |  |  |  |  |  |   52|  62.6k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  62.6k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  62.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  62.6k|{ \
  |  |  |  |  |  |  128|  78.7k|    do { \
  |  |  |  |  |  |  129|  78.7k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 10.2k, False: 68.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  10.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  10.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  10.2k|{ \
  |  |  |  |  |  |  |  |  104|  10.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  10.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  10.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  10.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  10.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.28k, False: 2.97k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  7.28k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.19k, False: 91]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  7.19k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  7.19k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  7.19k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  7.19k|            } else { \
  |  |  |  |  |  |  |  |  114|     91|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     91|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     91|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     91|            } \
  |  |  |  |  |  |  |  |  118|  7.28k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.97k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.97k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.97k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.97k|        } \
  |  |  |  |  |  |  |  |  123|  10.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  10.2k|        } \
  |  |  |  |  |  |  132|  78.7k|        a <<= 1; \
  |  |  |  |  |  |  133|  78.7k|        c <<= 1; \
  |  |  |  |  |  |  134|  78.7k|        ct--; \
  |  |  |  |  |  |  135|  78.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 16.0k, False: 62.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  62.6k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  62.6k|        } else { \
  |  |  |  |  154|  11.8k|            d = (*curctx)->mps; \
  |  |  |  |  155|  11.8k|        } \
  |  |  |  |  156|  74.5k|    } \
  |  |  |  |  157|   146k|}
  |  |  ------------------
  |  | 1280|   146k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   146k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   146k|{ \
  |  |  |  |  140|   146k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   146k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   146k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   146k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   146k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   146k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 71.6k, False: 75.0k]
  |  |  |  |  ------------------
  |  |  |  |  146|  71.6k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  71.6k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  71.6k|{ \
  |  |  |  |  |  |   57|  71.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 17.3k, False: 54.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  17.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  17.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  17.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  54.3k|    } else { \
  |  |  |  |  |  |   62|  54.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  54.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  54.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  54.3k|    } \
  |  |  |  |  |  |   66|  71.6k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  71.6k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  71.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  71.6k|{ \
  |  |  |  |  |  |  128|  71.6k|    do { \
  |  |  |  |  |  |  129|  71.6k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 8.59k, False: 63.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  8.59k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  8.59k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  8.59k|{ \
  |  |  |  |  |  |  |  |  104|  8.59k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  8.59k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  8.59k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  8.59k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  8.59k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.28k, False: 2.31k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  6.28k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.21k, False: 74]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  6.21k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  6.21k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  6.21k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  6.21k|            } else { \
  |  |  |  |  |  |  |  |  114|     74|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     74|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     74|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     74|            } \
  |  |  |  |  |  |  |  |  118|  6.28k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.31k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.31k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.31k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.31k|        } \
  |  |  |  |  |  |  |  |  123|  8.59k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  8.59k|        } \
  |  |  |  |  |  |  132|  71.6k|        a <<= 1; \
  |  |  |  |  |  |  133|  71.6k|        c <<= 1; \
  |  |  |  |  |  |  134|  71.6k|        ct--; \
  |  |  |  |  |  |  135|  71.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 71.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  71.6k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  75.0k|    } else {  \
  |  |  |  |  149|  75.0k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  75.0k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 63.7k, False: 11.2k]
  |  |  |  |  ------------------
  |  |  |  |  151|  63.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  63.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  63.7k|{ \
  |  |  |  |  |  |   45|  63.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 13.9k, False: 49.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  13.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  13.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  49.8k|    } else { \
  |  |  |  |  |  |   49|  49.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  49.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  49.8k|    } \
  |  |  |  |  |  |   52|  63.7k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  63.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  63.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  63.7k|{ \
  |  |  |  |  |  |  128|  72.1k|    do { \
  |  |  |  |  |  |  129|  72.1k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 8.76k, False: 63.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  8.76k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  8.76k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  8.76k|{ \
  |  |  |  |  |  |  |  |  104|  8.76k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  8.76k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  8.76k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  8.76k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  8.76k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.28k, False: 2.48k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  6.28k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.18k, False: 100]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  6.18k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  6.18k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  6.18k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  6.18k|            } else { \
  |  |  |  |  |  |  |  |  114|    100|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    100|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    100|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    100|            } \
  |  |  |  |  |  |  |  |  118|  6.28k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.48k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.48k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.48k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.48k|        } \
  |  |  |  |  |  |  |  |  123|  8.76k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  8.76k|        } \
  |  |  |  |  |  |  132|  72.1k|        a <<= 1; \
  |  |  |  |  |  |  133|  72.1k|        c <<= 1; \
  |  |  |  |  |  |  134|  72.1k|        ct--; \
  |  |  |  |  |  |  135|  72.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 8.35k, False: 63.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  63.7k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  63.7k|        } else { \
  |  |  |  |  154|  11.2k|            d = (*curctx)->mps; \
  |  |  |  |  155|  11.2k|        } \
  |  |  |  |  156|  75.0k|    } \
  |  |  |  |  157|   146k|}
  |  |  ------------------
  |  | 1281|   146k|                runlen = (runlen << 1) | v; \
  |  | 1282|   146k|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1282:24): [True: 0, False: 146k]
  |  |  ------------------
  |  | 1283|  45.1k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1283:21): [True: 45.1k, False: 101k]
  |  |  ------------------
  |  | 1284|  45.1k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1121|  45.1k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  45.1k|{ \
  |  |  |  | 1123|  45.1k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  45.1k|        do { \
  |  |  |  | 1125|  45.1k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|      0|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|      0|{ \
  |  |  |  |  |  |  140|      0|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|      0|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|      0|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|      0|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|      0|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|      0|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|      0|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|      0|{ \
  |  |  |  |  |  |  |  |   57|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|      0|    } else { \
  |  |  |  |  |  |  |  |   62|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|      0|    } \
  |  |  |  |  |  |  |  |   66|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|      0|    } else {  \
  |  |  |  |  |  |  149|      0|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|      0|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|      0|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|      0|{ \
  |  |  |  |  |  |  |  |   45|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|      0|    } else { \
  |  |  |  |  |  |  |  |   49|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|      0|    } \
  |  |  |  |  |  |  |  |   52|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|        } else { \
  |  |  |  |  |  |  154|      0|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      0|        } \
  |  |  |  |  |  |  156|      0|    } \
  |  |  |  |  |  |  157|      0|}
  |  |  |  |  ------------------
  |  |  |  | 1129|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1130|      0|                    break; \
  |  |  |  | 1131|      0|            } \
  |  |  |  | 1132|  45.1k|            { \
  |  |  |  | 1133|  45.1k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  45.1k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  45.1k|                                    ci); \
  |  |  |  | 1136|  45.1k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  45.1k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  45.1k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  45.1k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  45.1k|{ \
  |  |  |  |  |  |  140|  45.1k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  45.1k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  45.1k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  45.1k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  45.1k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  45.1k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 16.4k, False: 28.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  16.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  16.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  16.4k|{ \
  |  |  |  |  |  |  |  |   57|  16.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 991, False: 15.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    991|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    991|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    991|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  15.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  15.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  15.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  15.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  15.4k|    } \
  |  |  |  |  |  |  |  |   66|  16.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  16.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  16.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  16.4k|{ \
  |  |  |  |  |  |  |  |  128|  25.3k|    do { \
  |  |  |  |  |  |  |  |  129|  25.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.97k, False: 22.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.97k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.97k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.97k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.97k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.97k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.97k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.97k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.97k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.26k, False: 712]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.26k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.23k, False: 29]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.23k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.23k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.23k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.23k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     29|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     29|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     29|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     29|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.26k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    712|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    712|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    712|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    712|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.97k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.97k|        } \
  |  |  |  |  |  |  |  |  132|  25.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  25.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  25.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  25.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8.87k, False: 16.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  16.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  28.6k|    } else {  \
  |  |  |  |  |  |  149|  28.6k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  28.6k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 15.8k, False: 12.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  15.8k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  15.8k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  15.8k|{ \
  |  |  |  |  |  |  |  |   45|  15.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 720, False: 15.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    720|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    720|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  15.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  15.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  15.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  15.1k|    } \
  |  |  |  |  |  |  |  |   52|  15.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  15.8k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  15.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  15.8k|{ \
  |  |  |  |  |  |  |  |  128|  16.0k|    do { \
  |  |  |  |  |  |  |  |  129|  16.0k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.07k, False: 13.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.07k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.07k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.07k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.07k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.07k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.07k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.07k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.07k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.59k, False: 482]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.59k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.57k, False: 19]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.57k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.57k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.57k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.57k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     19|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     19|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     19|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     19|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.59k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    482|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    482|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    482|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    482|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.07k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.07k|        } \
  |  |  |  |  |  |  |  |  132|  16.0k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  16.0k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  16.0k|        ct--; \
  |  |  |  |  |  |  |  |  135|  16.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 175, False: 15.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  15.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  15.8k|        } else { \
  |  |  |  |  |  |  154|  12.7k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  12.7k|        } \
  |  |  |  |  |  |  156|  28.6k|    } \
  |  |  |  |  |  |  157|  45.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  45.1k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  45.1k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 21.7k, False: 23.3k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  45.1k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  45.1k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  45.1k|{ \
  |  |  |  |  |  |  326|  45.1k|    /* east */ \
  |  |  |  |  |  |  327|  45.1k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  45.1k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  45.1k| \
  |  |  |  |  |  |  329|  45.1k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  45.1k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  45.1k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  45.1k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  45.1k| \
  |  |  |  |  |  |  332|  45.1k|    /* west */ \
  |  |  |  |  |  |  333|  45.1k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  45.1k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  45.1k| \
  |  |  |  |  |  |  335|  45.1k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  45.1k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|  45.1k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|  45.1k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|  45.1k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|  45.1k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|  45.1k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|  45.1k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|  45.1k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|  45.1k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|  45.1k|    } \
  |  |  |  |  |  |  342|  45.1k| \
  |  |  |  |  |  |  343|  45.1k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  45.1k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  45.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  45.1k|            } \
  |  |  |  | 1142|  45.1k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  45.1k|    } \
  |  |  |  | 1144|  45.1k|}
  |  |  ------------------
  |  | 1285|  45.1k|                                            flags, flagsp, flags_stride, data, \
  |  | 1286|  45.1k|                                            l_w, 0, mqc, curctx, \
  |  | 1287|  45.1k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1288|  45.1k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  45.1k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1289|  45.1k|                        /* FALLTHRU */ \
  |  | 1290|  82.7k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1290:21): [True: 37.6k, False: 109k]
  |  |  ------------------
  |  | 1291|  82.7k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  82.7k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  82.7k|{ \
  |  |  |  | 1123|  82.7k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  82.7k|        do { \
  |  |  |  | 1125|  82.7k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 45.1k, False: 37.6k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  45.1k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  45.1k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  45.1k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  45.1k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  45.1k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  45.1k|{ \
  |  |  |  |  |  |  140|  45.1k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  45.1k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  45.1k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  45.1k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  45.1k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  45.1k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 10.9k, False: 34.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  10.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  10.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  10.9k|{ \
  |  |  |  |  |  |  |  |   57|  10.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 2.39k, False: 8.59k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  2.39k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  2.39k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  2.39k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  8.59k|    } else { \
  |  |  |  |  |  |  |  |   62|  8.59k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  8.59k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  8.59k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  8.59k|    } \
  |  |  |  |  |  |  |  |   66|  10.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  10.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  10.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  10.9k|{ \
  |  |  |  |  |  |  |  |  128|  17.7k|    do { \
  |  |  |  |  |  |  |  |  129|  17.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.54k, False: 15.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.54k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.54k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.54k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.54k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.54k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.54k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.54k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.54k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.95k, False: 594]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.95k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.92k, False: 27]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.92k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.92k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.92k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.92k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     27|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     27|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     27|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     27|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.95k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    594|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    594|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    594|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    594|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.54k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.54k|        } \
  |  |  |  |  |  |  |  |  132|  17.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  17.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  17.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  17.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.80k, False: 10.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  10.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  34.1k|    } else {  \
  |  |  |  |  |  |  149|  34.1k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  34.1k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 10.9k, False: 23.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  10.9k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  10.9k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  10.9k|{ \
  |  |  |  |  |  |  |  |   45|  10.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.43k, False: 9.46k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.43k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.43k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  9.46k|    } else { \
  |  |  |  |  |  |  |  |   49|  9.46k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  9.46k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  9.46k|    } \
  |  |  |  |  |  |  |  |   52|  10.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.9k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  10.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  10.9k|{ \
  |  |  |  |  |  |  |  |  128|  11.7k|    do { \
  |  |  |  |  |  |  |  |  129|  11.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.56k, False: 10.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.56k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.56k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.56k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.56k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.56k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.56k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.56k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.56k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.15k, False: 407]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.15k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.14k, False: 13]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.14k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.14k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.14k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.14k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     13|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     13|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     13|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     13|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.15k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    407|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    407|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    407|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    407|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.56k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.56k|        } \
  |  |  |  |  |  |  |  |  132|  11.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  11.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  11.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  11.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 838, False: 10.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  10.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  23.2k|        } else { \
  |  |  |  |  |  |  154|  23.2k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  23.2k|        } \
  |  |  |  |  |  |  156|  34.1k|    } \
  |  |  |  |  |  |  157|  45.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  45.1k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 22.1k, False: 22.9k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  45.1k|                    break; \
  |  |  |  | 1131|  45.1k|            } \
  |  |  |  | 1132|  82.7k|            { \
  |  |  |  | 1133|  60.5k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  60.5k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  60.5k|                                    ci); \
  |  |  |  | 1136|  60.5k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  60.5k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  60.5k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  60.5k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  60.5k|{ \
  |  |  |  |  |  |  140|  60.5k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  60.5k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  60.5k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  60.5k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  60.5k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  60.5k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 20.4k, False: 40.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  20.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  20.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  20.4k|{ \
  |  |  |  |  |  |  |  |   57|  20.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.09k, False: 19.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.09k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.09k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.09k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  19.3k|    } else { \
  |  |  |  |  |  |  |  |   62|  19.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  19.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  19.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  19.3k|    } \
  |  |  |  |  |  |  |  |   66|  20.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  20.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  20.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  20.4k|{ \
  |  |  |  |  |  |  |  |  128|  32.6k|    do { \
  |  |  |  |  |  |  |  |  129|  32.6k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.60k, False: 29.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.60k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.60k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.60k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.60k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.60k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.60k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.60k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.60k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.87k, False: 725]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.87k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.85k, False: 24]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.85k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.85k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.85k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.85k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     24|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     24|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     24|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     24|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.87k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    725|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    725|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    725|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    725|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.60k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.60k|        } \
  |  |  |  |  |  |  |  |  132|  32.6k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  32.6k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  32.6k|        ct--; \
  |  |  |  |  |  |  |  |  135|  32.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 12.2k, False: 20.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  20.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  40.1k|    } else {  \
  |  |  |  |  |  |  149|  40.1k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  40.1k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 19.7k, False: 20.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  19.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  19.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  19.7k|{ \
  |  |  |  |  |  |  |  |   45|  19.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 922, False: 18.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    922|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    922|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  18.8k|    } else { \
  |  |  |  |  |  |  |  |   49|  18.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  18.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  18.8k|    } \
  |  |  |  |  |  |  |  |   52|  19.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  19.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  19.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  19.7k|{ \
  |  |  |  |  |  |  |  |  128|  20.1k|    do { \
  |  |  |  |  |  |  |  |  129|  20.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.15k, False: 18.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.15k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.15k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.15k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.15k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.15k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.15k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.15k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.15k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.64k, False: 511]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.64k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.62k, False: 22]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.62k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.62k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.62k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.62k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     22|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     22|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     22|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     22|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.64k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    511|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    511|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    511|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    511|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.15k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.15k|        } \
  |  |  |  |  |  |  |  |  132|  20.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  20.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  20.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  20.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 440, False: 19.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  19.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  20.3k|        } else { \
  |  |  |  |  |  |  154|  20.3k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  20.3k|        } \
  |  |  |  |  |  |  156|  40.1k|    } \
  |  |  |  |  |  |  157|  60.5k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  60.5k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  60.5k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 29.8k, False: 30.6k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  60.5k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  60.5k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  60.5k|{ \
  |  |  |  |  |  |  326|  60.5k|    /* east */ \
  |  |  |  |  |  |  327|  60.5k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  60.5k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  60.5k| \
  |  |  |  |  |  |  329|  60.5k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  60.5k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  60.5k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  60.5k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  60.5k| \
  |  |  |  |  |  |  332|  60.5k|    /* west */ \
  |  |  |  |  |  |  333|  60.5k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  60.5k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  60.5k| \
  |  |  |  |  |  |  335|  60.5k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  60.5k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  60.5k| \
  |  |  |  |  |  |  343|  60.5k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  60.5k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  60.5k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  60.5k|            } \
  |  |  |  | 1142|  60.5k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  82.7k|    } \
  |  |  |  | 1144|  82.7k|}
  |  |  ------------------
  |  | 1292|  82.7k|                                            flags, flagsp, flags_stride, data, \
  |  | 1293|  82.7k|                                            l_w, 1, mqc, curctx, \
  |  | 1294|  82.7k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1295|  82.7k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  82.7k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1296|  82.7k|                        /* FALLTHRU */ \
  |  | 1297|   116k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1297:21): [True: 33.3k, False: 113k]
  |  |  ------------------
  |  | 1298|   116k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|   116k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|   116k|{ \
  |  |  |  | 1123|   116k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|   116k|        do { \
  |  |  |  | 1125|   116k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 82.7k, False: 33.3k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  82.7k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  82.7k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  82.7k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  82.7k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  82.7k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  82.7k|{ \
  |  |  |  |  |  |  140|  82.7k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  82.7k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  82.7k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  82.7k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  82.7k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  82.7k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 16.6k, False: 66.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  16.6k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  16.6k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  16.6k|{ \
  |  |  |  |  |  |  |  |   57|  16.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 3.55k, False: 13.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  3.55k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  3.55k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  3.55k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  13.0k|    } else { \
  |  |  |  |  |  |  |  |   62|  13.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  13.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  13.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  13.0k|    } \
  |  |  |  |  |  |  |  |   66|  16.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  16.6k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  16.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  16.6k|{ \
  |  |  |  |  |  |  |  |  128|  29.4k|    do { \
  |  |  |  |  |  |  |  |  129|  29.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.46k, False: 26.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.46k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.46k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.46k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.46k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.46k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.46k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.46k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.46k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.63k, False: 834]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.63k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.59k, False: 41]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.59k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.59k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.59k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.59k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     41|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     41|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     41|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     41|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.63k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    834|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    834|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    834|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    834|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.46k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.46k|        } \
  |  |  |  |  |  |  |  |  132|  29.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  29.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  29.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  29.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 12.8k, False: 16.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  16.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  66.0k|    } else {  \
  |  |  |  |  |  |  149|  66.0k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  66.0k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 17.0k, False: 49.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  17.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  17.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  17.0k|{ \
  |  |  |  |  |  |  |  |   45|  17.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 2.35k, False: 14.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  2.35k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  2.35k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  14.6k|    } else { \
  |  |  |  |  |  |  |  |   49|  14.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  14.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  14.6k|    } \
  |  |  |  |  |  |  |  |   52|  17.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  17.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  17.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  17.0k|{ \
  |  |  |  |  |  |  |  |  128|  18.2k|    do { \
  |  |  |  |  |  |  |  |  129|  18.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.20k, False: 16.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.20k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.20k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.20k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.20k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.20k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.20k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.20k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.20k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.58k, False: 615]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.58k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.52k, False: 61]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.52k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.52k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.52k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.52k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     61|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     61|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     61|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     61|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.58k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    615|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    615|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    615|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    615|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.20k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.20k|        } \
  |  |  |  |  |  |  |  |  132|  18.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  18.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  18.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  18.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.24k, False: 17.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  17.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  49.0k|        } else { \
  |  |  |  |  |  |  154|  49.0k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  49.0k|        } \
  |  |  |  |  |  |  156|  66.0k|    } \
  |  |  |  |  |  |  157|  82.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  82.7k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 46.0k, False: 36.7k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  82.7k|                    break; \
  |  |  |  | 1131|  82.7k|            } \
  |  |  |  | 1132|   116k|            { \
  |  |  |  | 1133|  70.0k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  70.0k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  70.0k|                                    ci); \
  |  |  |  | 1136|  70.0k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  70.0k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  70.0k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  70.0k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  70.0k|{ \
  |  |  |  |  |  |  140|  70.0k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  70.0k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  70.0k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  70.0k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  70.0k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  70.0k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 20.4k, False: 49.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  20.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  20.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  20.4k|{ \
  |  |  |  |  |  |  |  |   57|  20.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 2.95k, False: 17.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  2.95k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  2.95k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  2.95k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  17.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  17.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  17.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  17.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  17.4k|    } \
  |  |  |  |  |  |  |  |   66|  20.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  20.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  20.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  20.4k|{ \
  |  |  |  |  |  |  |  |  128|  31.8k|    do { \
  |  |  |  |  |  |  |  |  129|  31.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.42k, False: 27.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.42k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.42k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.42k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.42k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.42k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.42k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.42k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.42k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.51k, False: 911]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.51k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.47k, False: 36]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.47k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.47k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.47k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.47k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     36|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     36|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     36|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     36|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.51k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    911|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    911|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    911|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    911|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.42k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.42k|        } \
  |  |  |  |  |  |  |  |  132|  31.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  31.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  31.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  31.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.4k, False: 20.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  20.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  49.6k|    } else {  \
  |  |  |  |  |  |  149|  49.6k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  49.6k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 23.3k, False: 26.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  23.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  23.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  23.3k|{ \
  |  |  |  |  |  |  |  |   45|  23.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 2.15k, False: 21.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  2.15k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  2.15k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  21.2k|    } else { \
  |  |  |  |  |  |  |  |   49|  21.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  21.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  21.2k|    } \
  |  |  |  |  |  |  |  |   52|  23.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  23.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  23.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  23.3k|{ \
  |  |  |  |  |  |  |  |  128|  24.4k|    do { \
  |  |  |  |  |  |  |  |  129|  24.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.96k, False: 21.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.96k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.96k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.96k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.96k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.96k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.96k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.96k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.96k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.41k, False: 548]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.41k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.39k, False: 19]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.39k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.39k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.39k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.39k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     19|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     19|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     19|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     19|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.41k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    548|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    548|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    548|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    548|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.96k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.96k|        } \
  |  |  |  |  |  |  |  |  132|  24.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  24.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  24.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  24.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.10k, False: 23.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  23.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  26.2k|        } else { \
  |  |  |  |  |  |  154|  26.2k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  26.2k|        } \
  |  |  |  |  |  |  156|  49.6k|    } \
  |  |  |  |  |  |  157|  70.0k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  70.0k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  70.0k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 34.9k, False: 35.0k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  70.0k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  70.0k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  70.0k|{ \
  |  |  |  |  |  |  326|  70.0k|    /* east */ \
  |  |  |  |  |  |  327|  70.0k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  70.0k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  70.0k| \
  |  |  |  |  |  |  329|  70.0k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  70.0k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  70.0k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  70.0k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  70.0k| \
  |  |  |  |  |  |  332|  70.0k|    /* west */ \
  |  |  |  |  |  |  333|  70.0k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  70.0k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  70.0k| \
  |  |  |  |  |  |  335|  70.0k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  70.0k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  70.0k| \
  |  |  |  |  |  |  343|  70.0k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  70.0k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  70.0k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  70.0k|            } \
  |  |  |  | 1142|  70.0k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   116k|    } \
  |  |  |  | 1144|   116k|}
  |  |  ------------------
  |  | 1299|   116k|                                            flags, flagsp, flags_stride, data, \
  |  | 1300|   116k|                                            l_w, 2, mqc, curctx, \
  |  | 1301|   116k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1302|   116k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   116k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1303|   116k|                        /* FALLTHRU */ \
  |  | 1304|   146k|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1304:21): [True: 30.7k, False: 116k]
  |  |  ------------------
  |  | 1305|   146k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|   146k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|   146k|{ \
  |  |  |  | 1123|   146k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|   146k|        do { \
  |  |  |  | 1125|   146k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 116k, False: 30.7k]
  |  |  |  |  ------------------
  |  |  |  | 1126|   116k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   116k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   116k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   116k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   116k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   116k|{ \
  |  |  |  |  |  |  140|   116k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   116k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   116k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   116k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   116k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   116k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 17.2k, False: 98.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  17.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  17.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  17.2k|{ \
  |  |  |  |  |  |  |  |   57|  17.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 3.46k, False: 13.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  3.46k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  3.46k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  3.46k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  13.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  13.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  13.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  13.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  13.8k|    } \
  |  |  |  |  |  |  |  |   66|  17.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  17.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  17.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  17.2k|{ \
  |  |  |  |  |  |  |  |  128|  32.6k|    do { \
  |  |  |  |  |  |  |  |  129|  32.6k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.11k, False: 28.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.11k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.11k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.11k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.11k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.11k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.11k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.11k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.11k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.95k, False: 1.16k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.95k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.91k, False: 36]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.91k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.91k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.91k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.91k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     36|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     36|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     36|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     36|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.95k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.16k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.16k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.16k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.16k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.11k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.11k|        } \
  |  |  |  |  |  |  |  |  132|  32.6k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  32.6k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  32.6k|        ct--; \
  |  |  |  |  |  |  |  |  135|  32.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 15.3k, False: 17.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  17.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  98.7k|    } else {  \
  |  |  |  |  |  |  149|  98.7k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  98.7k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 20.6k, False: 78.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  20.6k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  20.6k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  20.6k|{ \
  |  |  |  |  |  |  |  |   45|  20.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 2.57k, False: 18.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  2.57k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  2.57k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  18.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  18.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  18.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  18.0k|    } \
  |  |  |  |  |  |  |  |   52|  20.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  20.6k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  20.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  20.6k|{ \
  |  |  |  |  |  |  |  |  128|  22.0k|    do { \
  |  |  |  |  |  |  |  |  129|  22.0k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.80k, False: 18.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.80k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.80k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.80k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.80k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.80k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.80k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.80k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.80k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.01k, False: 782]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.01k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.99k, False: 25]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.99k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.99k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.99k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.99k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     25|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     25|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     25|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     25|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.01k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    782|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    782|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    782|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    782|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.80k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.80k|        } \
  |  |  |  |  |  |  |  |  132|  22.0k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  22.0k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  22.0k|        ct--; \
  |  |  |  |  |  |  |  |  135|  22.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.41k, False: 20.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  20.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  78.1k|        } else { \
  |  |  |  |  |  |  154|  78.1k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  78.1k|        } \
  |  |  |  |  |  |  156|  98.7k|    } \
  |  |  |  |  |  |  157|   116k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   116k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 70.3k, False: 45.6k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   116k|                    break; \
  |  |  |  | 1131|   116k|            } \
  |  |  |  | 1132|   146k|            { \
  |  |  |  | 1133|  76.3k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  76.3k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  76.3k|                                    ci); \
  |  |  |  | 1136|  76.3k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  76.3k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  76.3k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  76.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  76.3k|{ \
  |  |  |  |  |  |  140|  76.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  76.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  76.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  76.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  76.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  76.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 25.0k, False: 51.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  25.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  25.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  25.0k|{ \
  |  |  |  |  |  |  |  |   57|  25.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 4.74k, False: 20.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  4.74k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  4.74k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  4.74k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  20.3k|    } else { \
  |  |  |  |  |  |  |  |   62|  20.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  20.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  20.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  20.3k|    } \
  |  |  |  |  |  |  |  |   66|  25.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  25.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  25.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  25.0k|{ \
  |  |  |  |  |  |  |  |  128|  37.8k|    do { \
  |  |  |  |  |  |  |  |  129|  37.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.93k, False: 33.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.93k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.93k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.93k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.93k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.93k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.93k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.93k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.93k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.04k, False: 895]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.04k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.02k, False: 22]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.02k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.02k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.02k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.02k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     22|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     22|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     22|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     22|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.04k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    895|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    895|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    895|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    895|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.93k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.93k|        } \
  |  |  |  |  |  |  |  |  132|  37.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  37.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  37.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  37.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 12.7k, False: 25.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  25.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  51.3k|    } else {  \
  |  |  |  |  |  |  149|  51.3k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  51.3k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 23.8k, False: 27.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  23.8k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  23.8k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  23.8k|{ \
  |  |  |  |  |  |  |  |   45|  23.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 2.87k, False: 21.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  2.87k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  2.87k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  21.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  21.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  21.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  21.0k|    } \
  |  |  |  |  |  |  |  |   52|  23.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  23.8k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  23.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  23.8k|{ \
  |  |  |  |  |  |  |  |  128|  25.1k|    do { \
  |  |  |  |  |  |  |  |  129|  25.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.46k, False: 21.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.46k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.46k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.46k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.46k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.46k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.46k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.46k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.46k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.73k, False: 731]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.73k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.71k, False: 19]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.71k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.71k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.71k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.71k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     19|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     19|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     19|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     19|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.73k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    731|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    731|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    731|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    731|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.46k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.46k|        } \
  |  |  |  |  |  |  |  |  132|  25.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  25.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  25.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  25.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.29k, False: 23.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  23.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  27.4k|        } else { \
  |  |  |  |  |  |  154|  27.4k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  27.4k|        } \
  |  |  |  |  |  |  156|  51.3k|    } \
  |  |  |  |  |  |  157|  76.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  76.3k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  76.3k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 36.0k, False: 40.3k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  76.3k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  76.3k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  76.3k|{ \
  |  |  |  |  |  |  326|  76.3k|    /* east */ \
  |  |  |  |  |  |  327|  76.3k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  76.3k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  76.3k| \
  |  |  |  |  |  |  329|  76.3k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  76.3k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  76.3k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  76.3k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  76.3k| \
  |  |  |  |  |  |  332|  76.3k|    /* west */ \
  |  |  |  |  |  |  333|  76.3k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  76.3k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  76.3k| \
  |  |  |  |  |  |  335|  76.3k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  76.3k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  76.3k| \
  |  |  |  |  |  |  343|  76.3k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  76.3k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  76.3k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|  76.3k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  76.3k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  76.3k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|  76.3k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  76.3k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  76.3k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  76.3k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|  76.3k|    } \
  |  |  |  |  |  |  350|  76.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  76.3k|            } \
  |  |  |  | 1142|  76.3k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   146k|    } \
  |  |  |  | 1144|   146k|}
  |  |  ------------------
  |  | 1306|   146k|                                            flags, flagsp, flags_stride, data, \
  |  | 1307|   146k|                                            l_w, 3, mqc, curctx, \
  |  | 1308|   146k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1309|   146k|                        break; \
  |  | 1310|   146k|                } \
  |  | 1311|  2.36M|            } else { \
  |  | 1312|  2.36M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.36M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.36M|{ \
  |  |  |  | 1123|  2.36M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.36M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.36M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.36M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.36M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 921k, False: 1.44M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   921k|        do { \
  |  |  |  | 1125|   921k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   921k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   921k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   921k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   921k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   921k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   921k|{ \
  |  |  |  |  |  |  140|   921k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   921k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   921k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   921k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   921k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   921k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 164k, False: 756k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   164k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   164k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   164k|{ \
  |  |  |  |  |  |  |  |   57|   164k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 31.0k, False: 133k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  31.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  31.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  31.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   133k|    } else { \
  |  |  |  |  |  |  |  |   62|   133k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   133k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   133k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   133k|    } \
  |  |  |  |  |  |  |  |   66|   164k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   164k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   164k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   164k|{ \
  |  |  |  |  |  |  |  |  128|   301k|    do { \
  |  |  |  |  |  |  |  |  129|   301k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 36.5k, False: 265k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  36.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  36.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  36.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  36.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  36.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  36.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  36.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  36.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 29.6k, False: 6.92k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  29.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 29.4k, False: 171]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  29.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  29.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  29.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  29.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    171|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    171|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    171|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    171|            } \
  |  |  |  |  |  |  |  |  |  |  118|  29.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.92k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.92k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.92k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.92k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  36.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  36.5k|        } \
  |  |  |  |  |  |  |  |  132|   301k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   301k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   301k|        ct--; \
  |  |  |  |  |  |  |  |  135|   301k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 136k, False: 164k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   164k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   756k|    } else {  \
  |  |  |  |  |  |  149|   756k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   756k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 193k, False: 563k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   193k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   193k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   193k|{ \
  |  |  |  |  |  |  |  |   45|   193k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 24.5k, False: 169k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  24.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  24.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   169k|    } else { \
  |  |  |  |  |  |  |  |   49|   169k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   169k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   169k|    } \
  |  |  |  |  |  |  |  |   52|   193k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   193k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   193k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   193k|{ \
  |  |  |  |  |  |  |  |  128|   205k|    do { \
  |  |  |  |  |  |  |  |  129|   205k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 26.8k, False: 179k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  26.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  26.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  26.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  26.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  26.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  26.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  26.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  26.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 22.5k, False: 4.31k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  22.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 22.4k, False: 104]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  22.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  22.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  22.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  22.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    104|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    104|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    104|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    104|            } \
  |  |  |  |  |  |  |  |  |  |  118|  22.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.31k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.31k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.31k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.31k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  26.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  26.8k|        } \
  |  |  |  |  |  |  |  |  132|   205k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   205k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   205k|        ct--; \
  |  |  |  |  |  |  |  |  135|   205k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.9k, False: 193k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   193k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   563k|        } else { \
  |  |  |  |  |  |  154|   563k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   563k|        } \
  |  |  |  |  |  |  156|   756k|    } \
  |  |  |  |  |  |  157|   921k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   921k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 598k, False: 323k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   921k|                    break; \
  |  |  |  | 1131|   921k|            } \
  |  |  |  | 1132|   921k|            { \
  |  |  |  | 1133|   323k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   323k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   323k|                                    ci); \
  |  |  |  | 1136|   323k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   323k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   323k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   323k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   323k|{ \
  |  |  |  |  |  |  140|   323k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   323k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   323k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   323k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   323k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   323k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 82.2k, False: 241k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  82.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  82.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  82.2k|{ \
  |  |  |  |  |  |  |  |   57|  82.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 17.5k, False: 64.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  17.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  17.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  17.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  64.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  64.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  64.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  64.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  64.7k|    } \
  |  |  |  |  |  |  |  |   66|  82.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  82.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  82.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  82.2k|{ \
  |  |  |  |  |  |  |  |  128|   134k|    do { \
  |  |  |  |  |  |  |  |  129|   134k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.9k, False: 117k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 15.3k, False: 1.62k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.2k, False: 82]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     82|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     82|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     82|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     82|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.62k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.62k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.62k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.62k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.9k|        } \
  |  |  |  |  |  |  |  |  132|   134k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   134k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   134k|        ct--; \
  |  |  |  |  |  |  |  |  135|   134k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 52.3k, False: 82.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  82.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   241k|    } else {  \
  |  |  |  |  |  |  149|   241k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   241k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 90.6k, False: 150k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  90.6k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  90.6k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  90.6k|{ \
  |  |  |  |  |  |  |  |   45|  90.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 13.3k, False: 77.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  13.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  13.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  77.3k|    } else { \
  |  |  |  |  |  |  |  |   49|  77.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  77.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  77.3k|    } \
  |  |  |  |  |  |  |  |   52|  90.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  90.6k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  90.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  90.6k|{ \
  |  |  |  |  |  |  |  |  128|  97.1k|    do { \
  |  |  |  |  |  |  |  |  129|  97.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.2k, False: 85.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  11.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  11.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  11.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  11.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  11.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  11.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  11.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  11.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.86k, False: 1.35k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.86k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.77k, False: 88]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.77k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.77k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.77k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.77k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     88|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     88|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     88|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     88|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.86k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.35k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.35k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.35k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.35k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.2k|        } \
  |  |  |  |  |  |  |  |  132|  97.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  97.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  97.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  97.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.49k, False: 90.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  90.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   150k|        } else { \
  |  |  |  |  |  |  154|   150k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   150k|        } \
  |  |  |  |  |  |  156|   241k|    } \
  |  |  |  |  |  |  157|   323k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   323k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   323k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 169k, False: 153k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   323k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   323k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   323k|{ \
  |  |  |  |  |  |  326|   323k|    /* east */ \
  |  |  |  |  |  |  327|   323k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   323k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   323k| \
  |  |  |  |  |  |  329|   323k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   323k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   323k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   323k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   323k| \
  |  |  |  |  |  |  332|   323k|    /* west */ \
  |  |  |  |  |  |  333|   323k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   323k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   323k| \
  |  |  |  |  |  |  335|   323k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   323k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|   323k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|   323k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|   323k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|   323k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|   323k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|   323k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|   323k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|   323k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|   323k|    } \
  |  |  |  |  |  |  342|   323k| \
  |  |  |  |  |  |  343|   323k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   323k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   323k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   323k|            } \
  |  |  |  | 1142|   323k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   921k|    } \
  |  |  |  | 1144|  2.36M|}
  |  |  ------------------
  |  | 1313|  2.36M|                                    flags, flagsp, flags_stride, data, \
  |  | 1314|  2.36M|                                    l_w, 0, mqc, curctx, \
  |  | 1315|  2.36M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1316|  2.36M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.36M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.36M|{ \
  |  |  |  | 1123|  2.36M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.36M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.36M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.36M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.36M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 912k, False: 1.45M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   912k|        do { \
  |  |  |  | 1125|   912k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   912k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   912k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   912k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   912k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   912k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   912k|{ \
  |  |  |  |  |  |  140|   912k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   912k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   912k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   912k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   912k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   912k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 185k, False: 726k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   185k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   185k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   185k|{ \
  |  |  |  |  |  |  |  |   57|   185k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 39.6k, False: 145k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  39.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  39.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  39.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   145k|    } else { \
  |  |  |  |  |  |  |  |   62|   145k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   145k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   145k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   145k|    } \
  |  |  |  |  |  |  |  |   66|   185k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   185k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   185k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   185k|{ \
  |  |  |  |  |  |  |  |  128|   314k|    do { \
  |  |  |  |  |  |  |  |  129|   314k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 38.6k, False: 275k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  38.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  38.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  38.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  38.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  38.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  38.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  38.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  38.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 31.5k, False: 7.05k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  31.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 31.3k, False: 202]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  31.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  31.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  31.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  31.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    202|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    202|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    202|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    202|            } \
  |  |  |  |  |  |  |  |  |  |  118|  31.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.05k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.05k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.05k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.05k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  38.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  38.6k|        } \
  |  |  |  |  |  |  |  |  132|   314k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   314k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   314k|        ct--; \
  |  |  |  |  |  |  |  |  135|   314k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 128k, False: 185k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   185k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   726k|    } else {  \
  |  |  |  |  |  |  149|   726k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   726k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 200k, False: 526k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   200k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   200k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   200k|{ \
  |  |  |  |  |  |  |  |   45|   200k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 28.8k, False: 171k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  28.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  28.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   171k|    } else { \
  |  |  |  |  |  |  |  |   49|   171k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   171k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   171k|    } \
  |  |  |  |  |  |  |  |   52|   200k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   200k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   200k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   200k|{ \
  |  |  |  |  |  |  |  |  128|   214k|    do { \
  |  |  |  |  |  |  |  |  129|   214k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 26.3k, False: 187k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  26.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  26.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  26.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  26.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  26.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  26.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  26.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  26.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 22.0k, False: 4.31k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  22.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 21.9k, False: 126]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  21.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  21.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  21.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  21.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    126|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    126|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    126|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    126|            } \
  |  |  |  |  |  |  |  |  |  |  118|  22.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.31k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.31k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.31k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.31k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  26.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  26.3k|        } \
  |  |  |  |  |  |  |  |  132|   214k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   214k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   214k|        ct--; \
  |  |  |  |  |  |  |  |  135|   214k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 14.1k, False: 200k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   200k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   526k|        } else { \
  |  |  |  |  |  |  154|   526k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   526k|        } \
  |  |  |  |  |  |  156|   726k|    } \
  |  |  |  |  |  |  157|   912k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   912k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 589k, False: 322k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   912k|                    break; \
  |  |  |  | 1131|   912k|            } \
  |  |  |  | 1132|   912k|            { \
  |  |  |  | 1133|   322k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   322k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   322k|                                    ci); \
  |  |  |  | 1136|   322k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   322k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   322k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   322k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   322k|{ \
  |  |  |  |  |  |  140|   322k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   322k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   322k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   322k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   322k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   322k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 93.9k, False: 229k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  93.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  93.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  93.9k|{ \
  |  |  |  |  |  |  |  |   57|  93.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.2k, False: 75.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  75.6k|    } else { \
  |  |  |  |  |  |  |  |   62|  75.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  75.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  75.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  75.6k|    } \
  |  |  |  |  |  |  |  |   66|  93.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  93.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  93.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  93.9k|{ \
  |  |  |  |  |  |  |  |  128|   150k|    do { \
  |  |  |  |  |  |  |  |  129|   150k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 20.5k, False: 130k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  20.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  20.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  20.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  20.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  20.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  20.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  20.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  20.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 19.0k, False: 1.48k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  19.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 18.9k, False: 74]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  18.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  18.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  18.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  18.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     74|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     74|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     74|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     74|            } \
  |  |  |  |  |  |  |  |  |  |  118|  19.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.48k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.48k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.48k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.48k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  20.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  20.5k|        } \
  |  |  |  |  |  |  |  |  132|   150k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   150k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   150k|        ct--; \
  |  |  |  |  |  |  |  |  135|   150k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 56.9k, False: 93.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  93.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   229k|    } else {  \
  |  |  |  |  |  |  149|   229k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   229k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 95.7k, False: 133k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  95.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  95.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  95.7k|{ \
  |  |  |  |  |  |  |  |   45|  95.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 14.5k, False: 81.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  14.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  14.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  81.2k|    } else { \
  |  |  |  |  |  |  |  |   49|  81.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  81.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  81.2k|    } \
  |  |  |  |  |  |  |  |   52|  95.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  95.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  95.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  95.7k|{ \
  |  |  |  |  |  |  |  |  128|   102k|    do { \
  |  |  |  |  |  |  |  |  129|   102k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.3k, False: 89.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  12.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  12.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  12.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  12.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  12.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  12.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  12.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  12.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.2k, False: 1.17k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.1k, False: 71]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     71|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     71|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     71|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     71|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.17k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.17k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.17k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.17k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.3k|        } \
  |  |  |  |  |  |  |  |  132|   102k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   102k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   102k|        ct--; \
  |  |  |  |  |  |  |  |  135|   102k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.37k, False: 95.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  95.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   133k|        } else { \
  |  |  |  |  |  |  154|   133k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   133k|        } \
  |  |  |  |  |  |  156|   229k|    } \
  |  |  |  |  |  |  157|   322k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   322k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   322k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 170k, False: 152k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   322k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   322k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   322k|{ \
  |  |  |  |  |  |  326|   322k|    /* east */ \
  |  |  |  |  |  |  327|   322k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   322k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   322k| \
  |  |  |  |  |  |  329|   322k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   322k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   322k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   322k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   322k| \
  |  |  |  |  |  |  332|   322k|    /* west */ \
  |  |  |  |  |  |  333|   322k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   322k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   322k| \
  |  |  |  |  |  |  335|   322k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   322k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   322k| \
  |  |  |  |  |  |  343|   322k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   322k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   322k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   322k|            } \
  |  |  |  | 1142|   322k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   912k|    } \
  |  |  |  | 1144|  2.36M|}
  |  |  ------------------
  |  | 1317|  2.36M|                                    flags, flagsp, flags_stride, data, \
  |  | 1318|  2.36M|                                    l_w, 1, mqc, curctx, \
  |  | 1319|  2.36M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1320|  2.36M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.36M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.36M|{ \
  |  |  |  | 1123|  2.36M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.36M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.36M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.36M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.36M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 902k, False: 1.46M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   902k|        do { \
  |  |  |  | 1125|   902k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   902k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   902k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   902k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   902k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   902k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   902k|{ \
  |  |  |  |  |  |  140|   902k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   902k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   902k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   902k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   902k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   902k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 173k, False: 728k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   173k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   173k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   173k|{ \
  |  |  |  |  |  |  |  |   57|   173k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 35.1k, False: 138k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  35.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  35.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  35.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   138k|    } else { \
  |  |  |  |  |  |  |  |   62|   138k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   138k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   138k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   138k|    } \
  |  |  |  |  |  |  |  |   66|   173k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   173k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   173k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   173k|{ \
  |  |  |  |  |  |  |  |  128|   301k|    do { \
  |  |  |  |  |  |  |  |  129|   301k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 37.7k, False: 263k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  37.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  37.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  37.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  37.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  37.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  37.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  37.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  37.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 31.4k, False: 6.27k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  31.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 31.2k, False: 162]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  31.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  31.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  31.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  31.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    162|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    162|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    162|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    162|            } \
  |  |  |  |  |  |  |  |  |  |  118|  31.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.27k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.27k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.27k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.27k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  37.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  37.7k|        } \
  |  |  |  |  |  |  |  |  132|   301k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   301k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   301k|        ct--; \
  |  |  |  |  |  |  |  |  135|   301k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 127k, False: 173k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   173k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   728k|    } else {  \
  |  |  |  |  |  |  149|   728k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   728k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 199k, False: 528k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   199k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   199k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   199k|{ \
  |  |  |  |  |  |  |  |   45|   199k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 27.3k, False: 172k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  27.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  27.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   172k|    } else { \
  |  |  |  |  |  |  |  |   49|   172k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   172k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   172k|    } \
  |  |  |  |  |  |  |  |   52|   199k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   199k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   199k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   199k|{ \
  |  |  |  |  |  |  |  |  128|   212k|    do { \
  |  |  |  |  |  |  |  |  129|   212k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 26.3k, False: 185k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  26.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  26.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  26.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  26.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  26.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  26.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  26.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  26.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 22.3k, False: 4.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  22.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 22.2k, False: 93]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  22.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  22.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  22.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  22.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     93|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     93|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     93|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     93|            } \
  |  |  |  |  |  |  |  |  |  |  118|  22.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.00k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.00k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.00k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.00k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  26.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  26.3k|        } \
  |  |  |  |  |  |  |  |  132|   212k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   212k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   212k|        ct--; \
  |  |  |  |  |  |  |  |  135|   212k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 12.6k, False: 199k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   199k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   528k|        } else { \
  |  |  |  |  |  |  154|   528k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   528k|        } \
  |  |  |  |  |  |  156|   728k|    } \
  |  |  |  |  |  |  157|   902k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   902k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 556k, False: 346k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   902k|                    break; \
  |  |  |  | 1131|   902k|            } \
  |  |  |  | 1132|   902k|            { \
  |  |  |  | 1133|   346k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   346k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   346k|                                    ci); \
  |  |  |  | 1136|   346k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   346k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   346k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   346k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   346k|{ \
  |  |  |  |  |  |  140|   346k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   346k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   346k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   346k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   346k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   346k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 96.9k, False: 249k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  96.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  96.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  96.9k|{ \
  |  |  |  |  |  |  |  |   57|  96.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 21.2k, False: 75.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  21.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  21.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  21.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  75.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  75.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  75.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  75.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  75.7k|    } \
  |  |  |  |  |  |  |  |   66|  96.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  96.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  96.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  96.9k|{ \
  |  |  |  |  |  |  |  |  128|   154k|    do { \
  |  |  |  |  |  |  |  |  129|   154k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.4k, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 17.8k, False: 1.54k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  17.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 17.7k, False: 111]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  17.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  17.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  17.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  17.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    111|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    111|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    111|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    111|            } \
  |  |  |  |  |  |  |  |  |  |  118|  17.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.54k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.54k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.54k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.54k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.4k|        } \
  |  |  |  |  |  |  |  |  132|   154k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   154k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   154k|        ct--; \
  |  |  |  |  |  |  |  |  135|   154k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 57.2k, False: 96.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  96.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   249k|    } else {  \
  |  |  |  |  |  |  149|   249k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   249k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 102k, False: 146k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   102k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   102k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   102k|{ \
  |  |  |  |  |  |  |  |   45|   102k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 16.7k, False: 85.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  16.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  16.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  85.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  85.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  85.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  85.4k|    } \
  |  |  |  |  |  |  |  |   52|   102k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   102k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   102k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   102k|{ \
  |  |  |  |  |  |  |  |  128|   109k|    do { \
  |  |  |  |  |  |  |  |  129|   109k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.1k, False: 95.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  14.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  14.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  14.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  14.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  14.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  14.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  14.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  14.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.8k, False: 1.35k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.7k, False: 64]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     64|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     64|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     64|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     64|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.35k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.35k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.35k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.35k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.1k|        } \
  |  |  |  |  |  |  |  |  132|   109k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   109k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   109k|        ct--; \
  |  |  |  |  |  |  |  |  135|   109k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.42k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   102k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   146k|        } else { \
  |  |  |  |  |  |  154|   146k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   146k|        } \
  |  |  |  |  |  |  156|   249k|    } \
  |  |  |  |  |  |  157|   346k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   346k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   346k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 181k, False: 164k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   346k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   346k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   346k|{ \
  |  |  |  |  |  |  326|   346k|    /* east */ \
  |  |  |  |  |  |  327|   346k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   346k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   346k| \
  |  |  |  |  |  |  329|   346k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   346k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   346k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   346k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   346k| \
  |  |  |  |  |  |  332|   346k|    /* west */ \
  |  |  |  |  |  |  333|   346k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   346k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   346k| \
  |  |  |  |  |  |  335|   346k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   346k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   346k| \
  |  |  |  |  |  |  343|   346k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   346k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   346k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   346k|            } \
  |  |  |  | 1142|   346k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   902k|    } \
  |  |  |  | 1144|  2.36M|}
  |  |  ------------------
  |  | 1321|  2.36M|                                    flags, flagsp, flags_stride, data, \
  |  | 1322|  2.36M|                                    l_w, 2, mqc, curctx, \
  |  | 1323|  2.36M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1324|  2.36M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  2.36M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  2.36M|{ \
  |  |  |  | 1123|  2.36M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.36M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.36M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.36M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  2.36M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 920k, False: 1.44M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   920k|        do { \
  |  |  |  | 1125|   920k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   920k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   920k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   920k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   920k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   920k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   920k|{ \
  |  |  |  |  |  |  140|   920k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   920k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   920k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   920k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   920k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   920k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 167k, False: 753k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   167k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   167k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   167k|{ \
  |  |  |  |  |  |  |  |   57|   167k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 29.4k, False: 137k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  29.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  29.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  29.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   137k|    } else { \
  |  |  |  |  |  |  |  |   62|   137k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   137k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   137k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   137k|    } \
  |  |  |  |  |  |  |  |   66|   167k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   167k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   167k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   167k|{ \
  |  |  |  |  |  |  |  |  128|   298k|    do { \
  |  |  |  |  |  |  |  |  129|   298k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 36.7k, False: 262k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  36.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  36.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  36.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  36.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  36.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  36.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  36.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  36.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 29.3k, False: 7.36k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  29.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 29.2k, False: 156]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  29.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  29.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  29.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  29.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    156|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    156|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    156|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    156|            } \
  |  |  |  |  |  |  |  |  |  |  118|  29.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.36k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.36k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.36k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.36k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  36.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  36.7k|        } \
  |  |  |  |  |  |  |  |  132|   298k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   298k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   298k|        ct--; \
  |  |  |  |  |  |  |  |  135|   298k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 131k, False: 167k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   167k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   753k|    } else {  \
  |  |  |  |  |  |  149|   753k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   753k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 190k, False: 562k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   190k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   190k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   190k|{ \
  |  |  |  |  |  |  |  |   45|   190k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 26.7k, False: 163k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  26.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  26.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   163k|    } else { \
  |  |  |  |  |  |  |  |   49|   163k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   163k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   163k|    } \
  |  |  |  |  |  |  |  |   52|   190k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   190k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   190k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   190k|{ \
  |  |  |  |  |  |  |  |  128|   203k|    do { \
  |  |  |  |  |  |  |  |  129|   203k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24.7k, False: 178k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  24.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  24.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  24.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  24.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  24.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  24.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  24.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  24.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 20.4k, False: 4.25k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  20.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 20.3k, False: 103]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  20.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  20.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  20.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  20.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    103|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    103|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    103|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    103|            } \
  |  |  |  |  |  |  |  |  |  |  118|  20.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.25k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.25k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.25k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.25k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  24.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  24.7k|        } \
  |  |  |  |  |  |  |  |  132|   203k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   203k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   203k|        ct--; \
  |  |  |  |  |  |  |  |  135|   203k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 12.8k, False: 190k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   190k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   562k|        } else { \
  |  |  |  |  |  |  154|   562k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   562k|        } \
  |  |  |  |  |  |  156|   753k|    } \
  |  |  |  |  |  |  157|   920k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   920k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 592k, False: 327k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   920k|                    break; \
  |  |  |  | 1131|   920k|            } \
  |  |  |  | 1132|   920k|            { \
  |  |  |  | 1133|   327k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|   327k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|   327k|                                    ci); \
  |  |  |  | 1136|   327k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   327k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|   327k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   327k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   327k|{ \
  |  |  |  |  |  |  140|   327k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   327k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   327k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   327k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   327k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   327k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 96.0k, False: 231k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  96.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  96.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  96.0k|{ \
  |  |  |  |  |  |  |  |   57|  96.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 21.4k, False: 74.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  21.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  21.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  21.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  74.6k|    } else { \
  |  |  |  |  |  |  |  |   62|  74.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  74.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  74.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  74.6k|    } \
  |  |  |  |  |  |  |  |   66|  96.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  96.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  96.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  96.0k|{ \
  |  |  |  |  |  |  |  |  128|   151k|    do { \
  |  |  |  |  |  |  |  |  129|   151k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.4k, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  17.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  17.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  17.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  17.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  17.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  17.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  17.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  17.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 15.6k, False: 1.81k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.5k, False: 85]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     85|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     85|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     85|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     85|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.81k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.81k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.81k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.81k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.4k|        } \
  |  |  |  |  |  |  |  |  132|   151k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   151k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   151k|        ct--; \
  |  |  |  |  |  |  |  |  135|   151k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.4k, False: 96.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  96.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   231k|    } else {  \
  |  |  |  |  |  |  149|   231k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   231k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 96.1k, False: 134k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  96.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  96.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  96.1k|{ \
  |  |  |  |  |  |  |  |   45|  96.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 14.4k, False: 81.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  14.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  14.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  81.7k|    } else { \
  |  |  |  |  |  |  |  |   49|  81.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  81.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  81.7k|    } \
  |  |  |  |  |  |  |  |   52|  96.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  96.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  96.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  96.1k|{ \
  |  |  |  |  |  |  |  |  128|   102k|    do { \
  |  |  |  |  |  |  |  |  129|   102k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.4k, False: 89.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  13.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  13.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  13.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  13.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  13.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  13.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  13.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  13.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.9k, False: 1.45k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.9k, False: 54]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     54|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     54|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     54|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     54|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.45k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.45k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.45k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.45k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.4k|        } \
  |  |  |  |  |  |  |  |  132|   102k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   102k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   102k|        ct--; \
  |  |  |  |  |  |  |  |  135|   102k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.39k, False: 96.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  96.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   134k|        } else { \
  |  |  |  |  |  |  154|   134k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   134k|        } \
  |  |  |  |  |  |  156|   231k|    } \
  |  |  |  |  |  |  157|   327k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   327k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|   327k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 165k, False: 161k]
  |  |  |  |  ------------------
  |  |  |  | 1140|   327k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   327k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   327k|{ \
  |  |  |  |  |  |  326|   327k|    /* east */ \
  |  |  |  |  |  |  327|   327k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   327k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   327k| \
  |  |  |  |  |  |  329|   327k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   327k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   327k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   327k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   327k| \
  |  |  |  |  |  |  332|   327k|    /* west */ \
  |  |  |  |  |  |  333|   327k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   327k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   327k| \
  |  |  |  |  |  |  335|   327k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   327k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   327k| \
  |  |  |  |  |  |  343|   327k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   327k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   327k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   327k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   327k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   327k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   327k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   327k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   327k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   327k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   327k|    } \
  |  |  |  |  |  |  350|   327k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|   327k|            } \
  |  |  |  | 1142|   327k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   920k|    } \
  |  |  |  | 1144|  2.36M|}
  |  |  ------------------
  |  | 1325|  2.36M|                                    flags, flagsp, flags_stride, data, \
  |  | 1326|  2.36M|                                    l_w, 3, mqc, curctx, \
  |  | 1327|  2.36M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1328|  2.36M|            } \
  |  | 1329|  3.81M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  2.51M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  2.51M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  2.51M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  2.51M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1330|  2.51M|        } \
  |  | 1331|  90.2k|    } \
  |  | 1332|  17.8k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  17.8k|        mqc->curctx = curctx; \
  |  |  |  |  167|  17.8k|        mqc->c = c; \
  |  |  |  |  168|  17.8k|        mqc->a = a; \
  |  |  |  |  169|  17.8k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1333|  17.8k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1333:9): [True: 1.24k, False: 16.6k]
  |  |  ------------------
  |  | 1334|   251k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1334:21): [True: 250k, False: 1.24k]
  |  |  ------------------
  |  | 1335|   751k|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1335:25): [True: 500k, False: 250k]
  |  |  ------------------
  |  | 1336|   500k|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1337|   500k|            } \
  |  | 1338|   250k|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|   250k|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|   250k|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|   250k|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|   250k|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1339|   250k|        } \
  |  | 1340|  1.24k|    } \
  |  | 1341|  17.8k|}
  ------------------
 1383|  17.8k|                                t1->w + 2U);
 1384|  17.8k|}
t1.c:opj_t1_dec_clnpass_check_segsym:
 1344|  37.0k|{
 1345|  37.0k|    if (cblksty & J2K_CCP_CBLKSTY_SEGSYM) {
  ------------------
  |  |   63|  37.0k|#define J2K_CCP_CBLKSTY_SEGSYM 0x20   /**< Segmentation symbols are used */
  ------------------
  |  Branch (1345:9): [True: 11.8k, False: 25.1k]
  ------------------
 1346|  11.8k|        opj_mqc_t* mqc = &(t1->mqc);
 1347|  11.8k|        OPJ_UINT32 v, v2;
 1348|  11.8k|        opj_mqc_setcurctx(mqc, T1_CTXNO_UNI);
  ------------------
  |  |  139|  11.8k|#define opj_mqc_setcurctx(mqc, ctxno)   (mqc)->curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  ------------------
 1349|  11.8k|        opj_mqc_decode(v, mqc);
  ------------------
  |  |  194|  11.8k|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|  11.8k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  11.8k|{ \
  |  |  |  |  140|  11.8k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  11.8k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  11.8k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  11.8k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  11.8k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  11.8k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 4.42k, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  146|  4.42k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  4.42k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  4.42k|{ \
  |  |  |  |  |  |   57|  4.42k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 2.62k, False: 1.80k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  2.62k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  2.62k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  2.62k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  2.62k|    } else { \
  |  |  |  |  |  |   62|  1.80k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  1.80k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  1.80k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  1.80k|    } \
  |  |  |  |  |  |   66|  4.42k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  4.42k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  4.42k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  4.42k|{ \
  |  |  |  |  |  |  128|  4.42k|    do { \
  |  |  |  |  |  |  129|  4.42k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 603, False: 3.82k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    603|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    603|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    603|{ \
  |  |  |  |  |  |  |  |  104|    603|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    603|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    603|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    603|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    603|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 571, False: 32]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    571|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 547, False: 24]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    547|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    547|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    547|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    547|            } else { \
  |  |  |  |  |  |  |  |  114|     24|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     24|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     24|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     24|            } \
  |  |  |  |  |  |  |  |  118|    571|        } else { \
  |  |  |  |  |  |  |  |  119|     32|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     32|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     32|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     32|        } \
  |  |  |  |  |  |  |  |  123|    603|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    603|        } \
  |  |  |  |  |  |  132|  4.42k|        a <<= 1; \
  |  |  |  |  |  |  133|  4.42k|        c <<= 1; \
  |  |  |  |  |  |  134|  4.42k|        ct--; \
  |  |  |  |  |  |  135|  4.42k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 4.42k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  4.42k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  7.43k|    } else {  \
  |  |  |  |  149|  7.43k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  7.43k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 4.27k, False: 3.16k]
  |  |  |  |  ------------------
  |  |  |  |  151|  4.27k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  4.27k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  4.27k|{ \
  |  |  |  |  |  |   45|  4.27k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 2.20k, False: 2.06k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  2.20k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  2.20k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  2.20k|    } else { \
  |  |  |  |  |  |   49|  2.06k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  2.06k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  2.06k|    } \
  |  |  |  |  |  |   52|  4.27k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  4.27k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  4.27k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  4.27k|{ \
  |  |  |  |  |  |  128|  5.36k|    do { \
  |  |  |  |  |  |  129|  5.36k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 860, False: 4.50k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    860|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    860|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    860|{ \
  |  |  |  |  |  |  |  |  104|    860|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    860|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    860|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    860|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    860|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 795, False: 65]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    795|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 792, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    792|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    792|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    792|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    792|            } else { \
  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  118|    795|        } else { \
  |  |  |  |  |  |  |  |  119|     65|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     65|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     65|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     65|        } \
  |  |  |  |  |  |  |  |  123|    860|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    860|        } \
  |  |  |  |  |  |  132|  5.36k|        a <<= 1; \
  |  |  |  |  |  |  133|  5.36k|        c <<= 1; \
  |  |  |  |  |  |  134|  5.36k|        ct--; \
  |  |  |  |  |  |  135|  5.36k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 1.09k, False: 4.27k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  4.27k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  4.27k|        } else { \
  |  |  |  |  154|  3.16k|            d = (*curctx)->mps; \
  |  |  |  |  155|  3.16k|        } \
  |  |  |  |  156|  7.43k|    } \
  |  |  |  |  157|  11.8k|}
  |  |  ------------------
  ------------------
 1350|  11.8k|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|  11.8k|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|  11.8k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  11.8k|{ \
  |  |  |  |  140|  11.8k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  11.8k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  11.8k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  11.8k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  11.8k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  11.8k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 5.30k, False: 6.55k]
  |  |  |  |  ------------------
  |  |  |  |  146|  5.30k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  5.30k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  5.30k|{ \
  |  |  |  |  |  |   57|  5.30k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 2.14k, False: 3.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  2.14k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  2.14k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  2.14k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  3.16k|    } else { \
  |  |  |  |  |  |   62|  3.16k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  3.16k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  3.16k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  3.16k|    } \
  |  |  |  |  |  |   66|  5.30k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  5.30k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  5.30k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  5.30k|{ \
  |  |  |  |  |  |  128|  5.30k|    do { \
  |  |  |  |  |  |  129|  5.30k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.46k, False: 3.84k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.46k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.46k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.46k|{ \
  |  |  |  |  |  |  |  |  104|  1.46k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.46k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.46k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.46k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.46k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.36k, False: 104]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  1.36k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.31k, False: 52]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.31k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.31k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.31k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.31k|            } else { \
  |  |  |  |  |  |  |  |  114|     52|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     52|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     52|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     52|            } \
  |  |  |  |  |  |  |  |  118|  1.36k|        } else { \
  |  |  |  |  |  |  |  |  119|    104|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    104|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    104|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    104|        } \
  |  |  |  |  |  |  |  |  123|  1.46k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.46k|        } \
  |  |  |  |  |  |  132|  5.30k|        a <<= 1; \
  |  |  |  |  |  |  133|  5.30k|        c <<= 1; \
  |  |  |  |  |  |  134|  5.30k|        ct--; \
  |  |  |  |  |  |  135|  5.30k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 5.30k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  5.30k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  6.55k|    } else {  \
  |  |  |  |  149|  6.55k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  6.55k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 5.29k, False: 1.25k]
  |  |  |  |  ------------------
  |  |  |  |  151|  5.29k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  5.29k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  5.29k|{ \
  |  |  |  |  |  |   45|  5.29k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 2.39k, False: 2.90k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  2.39k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  2.39k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  2.90k|    } else { \
  |  |  |  |  |  |   49|  2.90k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  2.90k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  2.90k|    } \
  |  |  |  |  |  |   52|  5.29k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  5.29k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  5.29k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  5.29k|{ \
  |  |  |  |  |  |  128|  6.15k|    do { \
  |  |  |  |  |  |  129|  6.15k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 942, False: 5.21k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    942|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    942|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    942|{ \
  |  |  |  |  |  |  |  |  104|    942|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    942|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    942|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    942|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    942|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 909, False: 33]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    909|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 908, False: 1]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    908|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    908|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    908|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    908|            } else { \
  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  118|    909|        } else { \
  |  |  |  |  |  |  |  |  119|     33|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     33|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     33|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     33|        } \
  |  |  |  |  |  |  |  |  123|    942|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    942|        } \
  |  |  |  |  |  |  132|  6.15k|        a <<= 1; \
  |  |  |  |  |  |  133|  6.15k|        c <<= 1; \
  |  |  |  |  |  |  134|  6.15k|        ct--; \
  |  |  |  |  |  |  135|  6.15k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 861, False: 5.29k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  5.29k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  5.29k|        } else { \
  |  |  |  |  154|  1.25k|            d = (*curctx)->mps; \
  |  |  |  |  155|  1.25k|        } \
  |  |  |  |  156|  6.55k|    } \
  |  |  |  |  157|  11.8k|}
  |  |  ------------------
  ------------------
 1351|  11.8k|        v = (v << 1) | v2;
 1352|  11.8k|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|  11.8k|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|  11.8k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  11.8k|{ \
  |  |  |  |  140|  11.8k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  11.8k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  11.8k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  11.8k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  11.8k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  11.8k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 5.73k, False: 6.13k]
  |  |  |  |  ------------------
  |  |  |  |  146|  5.73k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  5.73k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  5.73k|{ \
  |  |  |  |  |  |   57|  5.73k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 1.09k, False: 4.63k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  1.09k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  1.09k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  1.09k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  4.63k|    } else { \
  |  |  |  |  |  |   62|  4.63k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  4.63k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  4.63k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  4.63k|    } \
  |  |  |  |  |  |   66|  5.73k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  5.73k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  5.73k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  5.73k|{ \
  |  |  |  |  |  |  128|  5.73k|    do { \
  |  |  |  |  |  |  129|  5.73k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 291, False: 5.43k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    291|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    291|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    291|{ \
  |  |  |  |  |  |  |  |  104|    291|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    291|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    291|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    291|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    291|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 281, False: 10]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    281|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 277, False: 4]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    277|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    277|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    277|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    277|            } else { \
  |  |  |  |  |  |  |  |  114|      4|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      4|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      4|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      4|            } \
  |  |  |  |  |  |  |  |  118|    281|        } else { \
  |  |  |  |  |  |  |  |  119|     10|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     10|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     10|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     10|        } \
  |  |  |  |  |  |  |  |  123|    291|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    291|        } \
  |  |  |  |  |  |  132|  5.73k|        a <<= 1; \
  |  |  |  |  |  |  133|  5.73k|        c <<= 1; \
  |  |  |  |  |  |  134|  5.73k|        ct--; \
  |  |  |  |  |  |  135|  5.73k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 5.73k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  5.73k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  6.13k|    } else {  \
  |  |  |  |  149|  6.13k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  6.13k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 5.67k, False: 458]
  |  |  |  |  ------------------
  |  |  |  |  151|  5.67k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  5.67k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  5.67k|{ \
  |  |  |  |  |  |   45|  5.67k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 1.70k, False: 3.97k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  1.70k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  1.70k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  3.97k|    } else { \
  |  |  |  |  |  |   49|  3.97k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  3.97k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  3.97k|    } \
  |  |  |  |  |  |   52|  5.67k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  5.67k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  5.67k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  5.67k|{ \
  |  |  |  |  |  |  128|  6.65k|    do { \
  |  |  |  |  |  |  129|  6.65k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 514, False: 6.14k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    514|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    514|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    514|{ \
  |  |  |  |  |  |  |  |  104|    514|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    514|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    514|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    514|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    514|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 500, False: 14]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    500|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 493, False: 7]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    493|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    493|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    493|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    493|            } else { \
  |  |  |  |  |  |  |  |  114|      7|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      7|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      7|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      7|            } \
  |  |  |  |  |  |  |  |  118|    500|        } else { \
  |  |  |  |  |  |  |  |  119|     14|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     14|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     14|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     14|        } \
  |  |  |  |  |  |  |  |  123|    514|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    514|        } \
  |  |  |  |  |  |  132|  6.65k|        a <<= 1; \
  |  |  |  |  |  |  133|  6.65k|        c <<= 1; \
  |  |  |  |  |  |  134|  6.65k|        ct--; \
  |  |  |  |  |  |  135|  6.65k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 981, False: 5.67k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  5.67k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  5.67k|        } else { \
  |  |  |  |  154|    458|            d = (*curctx)->mps; \
  |  |  |  |  155|    458|        } \
  |  |  |  |  156|  6.13k|    } \
  |  |  |  |  157|  11.8k|}
  |  |  ------------------
  ------------------
 1353|  11.8k|        v = (v << 1) | v2;
 1354|  11.8k|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|  11.8k|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|  11.8k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  11.8k|{ \
  |  |  |  |  140|  11.8k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  11.8k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  11.8k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  11.8k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  11.8k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  11.8k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 5.13k, False: 6.72k]
  |  |  |  |  ------------------
  |  |  |  |  146|  5.13k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  5.13k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  5.13k|{ \
  |  |  |  |  |  |   57|  5.13k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 219, False: 4.91k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|    219|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|    219|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|    219|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  4.91k|    } else { \
  |  |  |  |  |  |   62|  4.91k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  4.91k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  4.91k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  4.91k|    } \
  |  |  |  |  |  |   66|  5.13k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  5.13k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  5.13k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  5.13k|{ \
  |  |  |  |  |  |  128|  5.13k|    do { \
  |  |  |  |  |  |  129|  5.13k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.05k, False: 4.08k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.05k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.05k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.05k|{ \
  |  |  |  |  |  |  |  |  104|  1.05k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.05k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.05k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.05k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.05k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.01k, False: 36]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  1.01k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.01k, False: 6]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.01k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.01k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.01k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.01k|            } else { \
  |  |  |  |  |  |  |  |  114|      6|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      6|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      6|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      6|            } \
  |  |  |  |  |  |  |  |  118|  1.01k|        } else { \
  |  |  |  |  |  |  |  |  119|     36|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     36|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     36|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     36|        } \
  |  |  |  |  |  |  |  |  123|  1.05k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.05k|        } \
  |  |  |  |  |  |  132|  5.13k|        a <<= 1; \
  |  |  |  |  |  |  133|  5.13k|        c <<= 1; \
  |  |  |  |  |  |  134|  5.13k|        ct--; \
  |  |  |  |  |  |  135|  5.13k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 5.13k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  5.13k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  6.72k|    } else {  \
  |  |  |  |  149|  6.72k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  6.72k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 6.26k, False: 457]
  |  |  |  |  ------------------
  |  |  |  |  151|  6.26k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  6.26k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  6.26k|{ \
  |  |  |  |  |  |   45|  6.26k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 979, False: 5.28k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|    979|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|    979|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  5.28k|    } else { \
  |  |  |  |  |  |   49|  5.28k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  5.28k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  5.28k|    } \
  |  |  |  |  |  |   52|  6.26k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  6.26k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  6.26k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  6.26k|{ \
  |  |  |  |  |  |  128|  6.73k|    do { \
  |  |  |  |  |  |  129|  6.73k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 625, False: 6.10k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    625|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    625|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    625|{ \
  |  |  |  |  |  |  |  |  104|    625|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    625|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    625|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    625|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    625|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 584, False: 41]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    584|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 574, False: 10]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    574|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    574|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    574|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    574|            } else { \
  |  |  |  |  |  |  |  |  114|     10|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     10|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     10|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     10|            } \
  |  |  |  |  |  |  |  |  118|    584|        } else { \
  |  |  |  |  |  |  |  |  119|     41|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     41|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     41|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     41|        } \
  |  |  |  |  |  |  |  |  123|    625|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    625|        } \
  |  |  |  |  |  |  132|  6.73k|        a <<= 1; \
  |  |  |  |  |  |  133|  6.73k|        c <<= 1; \
  |  |  |  |  |  |  134|  6.73k|        ct--; \
  |  |  |  |  |  |  135|  6.73k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 467, False: 6.26k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  6.26k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  6.26k|        } else { \
  |  |  |  |  154|    457|            d = (*curctx)->mps; \
  |  |  |  |  155|    457|        } \
  |  |  |  |  156|  6.72k|    } \
  |  |  |  |  157|  11.8k|}
  |  |  ------------------
  ------------------
 1355|  11.8k|        v = (v << 1) | v2;
 1356|       |        /*
 1357|       |        if (v!=0xa) {
 1358|       |            opj_event_msg(t1->cinfo, EVT_WARNING, "Bad segmentation symbol %x\n", v);
 1359|       |        }
 1360|       |        */
 1361|  11.8k|    }
 1362|  37.0k|}

opj_t2_decode_packets:
  402|  7.31k|{
  403|  7.31k|    OPJ_BYTE *l_current_data = p_src;
  404|  7.31k|    opj_pi_iterator_t *l_pi = 00;
  405|  7.31k|    OPJ_UINT32 pino;
  406|  7.31k|    opj_image_t *l_image = p_t2->image;
  407|  7.31k|    opj_cp_t *l_cp = p_t2->cp;
  408|  7.31k|    opj_tcp_t *l_tcp = &(p_t2->cp->tcps[p_tile_no]);
  409|  7.31k|    OPJ_UINT32 l_nb_bytes_read;
  410|  7.31k|    OPJ_UINT32 l_nb_pocs = l_tcp->numpocs + 1;
  411|  7.31k|    opj_pi_iterator_t *l_current_pi = 00;
  412|       |#ifdef TODO_MSD
  413|       |    OPJ_UINT32 curtp = 0;
  414|       |    OPJ_UINT32 tp_start_packno;
  415|       |#endif
  416|  7.31k|    opj_packet_info_t *l_pack_info = 00;
  417|  7.31k|    opj_image_comp_t* l_img_comp = 00;
  418|       |
  419|  7.31k|    OPJ_ARG_NOT_USED(p_cstr_index);
  ------------------
  |  |  144|  7.31k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
  420|       |
  421|       |#ifdef TODO_MSD
  422|       |    if (p_cstr_index) {
  423|       |        l_pack_info = p_cstr_index->tile_index[p_tile_no].packet;
  424|       |    }
  425|       |#endif
  426|       |
  427|       |    /* create a packet iterator */
  428|  7.31k|    l_pi = opj_pi_create_decode(l_image, l_cp, p_tile_no, p_manager);
  429|  7.31k|    if (!l_pi) {
  ------------------
  |  Branch (429:9): [True: 9, False: 7.30k]
  ------------------
  430|      9|        return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
  431|      9|    }
  432|       |
  433|       |
  434|  7.30k|    l_current_pi = l_pi;
  435|       |
  436|  17.1k|    for (pino = 0; pino <= l_tcp->numpocs; ++pino) {
  ------------------
  |  Branch (436:20): [True: 14.8k, False: 2.24k]
  ------------------
  437|       |
  438|       |        /* if the resolution needed is too low, one dim of the tilec could be equal to zero
  439|       |         * and no packets are used to decode this resolution and
  440|       |         * l_current_pi->resno is always >= p_tile->comps[l_current_pi->compno].minimum_num_resolutions
  441|       |         * and no l_img_comp->resno_decoded are computed
  442|       |         */
  443|  14.8k|        OPJ_BOOL* first_pass_failed = NULL;
  444|       |
  445|  14.8k|        if (l_current_pi->poc.prg == OPJ_PROG_UNKNOWN) {
  ------------------
  |  Branch (445:13): [True: 5, False: 14.8k]
  ------------------
  446|       |            /* TODO ADE : add an error */
  447|      5|            opj_pi_destroy(l_pi, l_nb_pocs);
  448|      5|            return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
  449|      5|        }
  450|       |
  451|  14.8k|        first_pass_failed = (OPJ_BOOL*)opj_malloc(l_image->numcomps * sizeof(OPJ_BOOL));
  452|  14.8k|        if (!first_pass_failed) {
  ------------------
  |  Branch (452:13): [True: 0, False: 14.8k]
  ------------------
  453|      0|            opj_pi_destroy(l_pi, l_nb_pocs);
  454|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  455|      0|        }
  456|  14.8k|        memset(first_pass_failed, OPJ_TRUE, l_image->numcomps * sizeof(OPJ_BOOL));
  ------------------
  |  |  117|  14.8k|#define OPJ_TRUE 1
  ------------------
  457|       |
  458|  33.1M|        while (opj_pi_next(l_current_pi)) {
  ------------------
  |  Branch (458:16): [True: 33.1M, False: 9.82k]
  ------------------
  459|  33.1M|            OPJ_BOOL skip_packet = OPJ_FALSE;
  ------------------
  |  |  118|  33.1M|#define OPJ_FALSE 0
  ------------------
  460|  33.1M|            JAS_FPRINTF(stderr,
  ------------------
  |  |  390|  33.1M|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
  461|  33.1M|                        "packet offset=00000166 prg=%d cmptno=%02d rlvlno=%02d prcno=%03d lyrno=%02d\n\n",
  462|  33.1M|                        l_current_pi->poc.prg1, l_current_pi->compno, l_current_pi->resno,
  463|  33.1M|                        l_current_pi->precno, l_current_pi->layno);
  464|       |
  465|       |            /* If the packet layer is greater or equal than the maximum */
  466|       |            /* number of layers, skip the packet */
  467|  33.1M|            if (l_current_pi->layno >= l_tcp->num_layers_to_decode) {
  ------------------
  |  Branch (467:17): [True: 0, False: 33.1M]
  ------------------
  468|      0|                skip_packet = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  469|      0|            }
  470|       |            /* If the packet resolution number is greater than the minimum */
  471|       |            /* number of resolution allowed, skip the packet */
  472|  33.1M|            else if (l_current_pi->resno >=
  ------------------
  |  Branch (472:22): [True: 0, False: 33.1M]
  ------------------
  473|  33.1M|                     p_tile->comps[l_current_pi->compno].minimum_num_resolutions) {
  474|      0|                skip_packet = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  475|  33.1M|            } else {
  476|       |                /* If no precincts of any band intersects the area of interest, */
  477|       |                /* skip the packet */
  478|  33.1M|                OPJ_UINT32 bandno;
  479|  33.1M|                opj_tcd_tilecomp_t *tilec = &p_tile->comps[l_current_pi->compno];
  480|  33.1M|                opj_tcd_resolution_t *res = &tilec->resolutions[l_current_pi->resno];
  481|       |
  482|  33.1M|                skip_packet = OPJ_TRUE;
  ------------------
  |  |  117|  33.1M|#define OPJ_TRUE 1
  ------------------
  483|  78.1M|                for (bandno = 0; bandno < res->numbands; ++bandno) {
  ------------------
  |  Branch (483:34): [True: 62.7M, False: 15.4M]
  ------------------
  484|  62.7M|                    opj_tcd_band_t* band = &res->bands[bandno];
  485|  62.7M|                    opj_tcd_precinct_t* prec = &band->precincts[l_current_pi->precno];
  486|       |
  487|  62.7M|                    if (opj_tcd_is_subband_area_of_interest(tcd,
  ------------------
  |  Branch (487:25): [True: 17.6M, False: 45.0M]
  ------------------
  488|  62.7M|                                                            l_current_pi->compno,
  489|  62.7M|                                                            l_current_pi->resno,
  490|  62.7M|                                                            band->bandno,
  491|  62.7M|                                                            (OPJ_UINT32)prec->x0,
  492|  62.7M|                                                            (OPJ_UINT32)prec->y0,
  493|  62.7M|                                                            (OPJ_UINT32)prec->x1,
  494|  62.7M|                                                            (OPJ_UINT32)prec->y1)) {
  495|  17.6M|                        skip_packet = OPJ_FALSE;
  ------------------
  |  |  118|  17.6M|#define OPJ_FALSE 0
  ------------------
  496|  17.6M|                        break;
  497|  17.6M|                    }
  498|  62.7M|                }
  499|       |                /*
  500|       |                                printf("packet cmptno=%02d rlvlno=%02d prcno=%03d lyrno=%02d -> %s\n",
  501|       |                                    l_current_pi->compno, l_current_pi->resno,
  502|       |                                    l_current_pi->precno, l_current_pi->layno, skip_packet ? "skipped" : "kept");
  503|       |                */
  504|  33.1M|            }
  505|  33.1M|            if (!skip_packet) {
  ------------------
  |  Branch (505:17): [True: 17.6M, False: 15.4M]
  ------------------
  506|  17.6M|                l_nb_bytes_read = 0;
  507|       |
  508|  17.6M|                first_pass_failed[l_current_pi->compno] = OPJ_FALSE;
  ------------------
  |  |  118|  17.6M|#define OPJ_FALSE 0
  ------------------
  509|       |
  510|  17.6M|                if (! opj_t2_decode_packet(p_t2, p_tile, l_tcp, l_current_pi, l_current_data,
  ------------------
  |  Branch (510:21): [True: 5.00k, False: 17.6M]
  ------------------
  511|  17.6M|                                           &l_nb_bytes_read, p_max_len, l_pack_info, p_manager)) {
  512|  5.00k|                    opj_pi_destroy(l_pi, l_nb_pocs);
  513|  5.00k|                    opj_free(first_pass_failed);
  514|  5.00k|                    return OPJ_FALSE;
  ------------------
  |  |  118|  5.00k|#define OPJ_FALSE 0
  ------------------
  515|  5.00k|                }
  516|       |
  517|  17.6M|                l_img_comp = &(l_image->comps[l_current_pi->compno]);
  518|  17.6M|                l_img_comp->resno_decoded = opj_uint_max(l_current_pi->resno,
  519|  17.6M|                                            l_img_comp->resno_decoded);
  520|  17.6M|            } else {
  521|  15.4M|                l_nb_bytes_read = 0;
  522|  15.4M|                if (! opj_t2_skip_packet(p_t2, p_tile, l_tcp, l_current_pi, l_current_data,
  ------------------
  |  Branch (522:21): [True: 41, False: 15.4M]
  ------------------
  523|  15.4M|                                         &l_nb_bytes_read, p_max_len, l_pack_info, p_manager)) {
  524|     41|                    opj_pi_destroy(l_pi, l_nb_pocs);
  525|     41|                    opj_free(first_pass_failed);
  526|     41|                    return OPJ_FALSE;
  ------------------
  |  |  118|     41|#define OPJ_FALSE 0
  ------------------
  527|     41|                }
  528|  15.4M|            }
  529|       |
  530|  33.1M|            if (first_pass_failed[l_current_pi->compno]) {
  ------------------
  |  Branch (530:17): [True: 76.0k, False: 33.0M]
  ------------------
  531|  76.0k|                l_img_comp = &(l_image->comps[l_current_pi->compno]);
  532|  76.0k|                if (l_img_comp->resno_decoded == 0) {
  ------------------
  |  Branch (532:21): [True: 49.9k, False: 26.1k]
  ------------------
  533|  49.9k|                    l_img_comp->resno_decoded =
  534|  49.9k|                        p_tile->comps[l_current_pi->compno].minimum_num_resolutions - 1;
  535|  49.9k|                }
  536|  76.0k|            }
  537|       |
  538|  33.1M|            l_current_data += l_nb_bytes_read;
  539|  33.1M|            p_max_len -= l_nb_bytes_read;
  540|       |
  541|       |            /* INDEX >> */
  542|       |#ifdef TODO_MSD
  543|       |            if (p_cstr_info) {
  544|       |                opj_tile_info_v2_t *info_TL = &p_cstr_info->tile[p_tile_no];
  545|       |                opj_packet_info_t *info_PK = &info_TL->packet[p_cstr_info->packno];
  546|       |                tp_start_packno = 0;
  547|       |                if (!p_cstr_info->packno) {
  548|       |                    info_PK->start_pos = info_TL->end_header + 1;
  549|       |                } else if (info_TL->packet[p_cstr_info->packno - 1].end_pos >=
  550|       |                           (OPJ_INT32)
  551|       |                           p_cstr_info->tile[p_tile_no].tp[curtp].tp_end_pos) { /* New tile part */
  552|       |                    info_TL->tp[curtp].tp_numpacks = p_cstr_info->packno -
  553|       |                                                     tp_start_packno; /* Number of packets in previous tile-part */
  554|       |                    tp_start_packno = p_cstr_info->packno;
  555|       |                    curtp++;
  556|       |                    info_PK->start_pos = p_cstr_info->tile[p_tile_no].tp[curtp].tp_end_header + 1;
  557|       |                } else {
  558|       |                    info_PK->start_pos = (l_cp->m_specific_param.m_enc.m_tp_on &&
  559|       |                                          info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[p_cstr_info->packno -
  560|       |                                                                      1].end_pos + 1;
  561|       |                }
  562|       |                info_PK->end_pos = info_PK->start_pos + l_nb_bytes_read - 1;
  563|       |                info_PK->end_ph_pos += info_PK->start_pos -
  564|       |                                       1;  /* End of packet header which now only represents the distance */
  565|       |                ++p_cstr_info->packno;
  566|       |            }
  567|       |#endif
  568|       |            /* << INDEX */
  569|  33.1M|        }
  570|  9.82k|        ++l_current_pi;
  571|       |
  572|  9.82k|        opj_free(first_pass_failed);
  573|  9.82k|    }
  574|       |    /* INDEX >> */
  575|       |#ifdef TODO_MSD
  576|       |    if
  577|       |    (p_cstr_info) {
  578|       |        p_cstr_info->tile[p_tile_no].tp[curtp].tp_numpacks = p_cstr_info->packno -
  579|       |                tp_start_packno; /* Number of packets in last tile-part */
  580|       |    }
  581|       |#endif
  582|       |    /* << INDEX */
  583|       |
  584|       |    /* don't forget to release pi */
  585|  2.24k|    opj_pi_destroy(l_pi, l_nb_pocs);
  586|  2.24k|    *p_data_read = (OPJ_UINT32)(l_current_data - p_src);
  587|  2.24k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.24k|#define OPJ_TRUE 1
  ------------------
  588|  7.30k|}
opj_t2_create:
  600|  7.31k|{
  601|       |    /* create the t2 structure */
  602|  7.31k|    opj_t2_t *l_t2 = (opj_t2_t*)opj_calloc(1, sizeof(opj_t2_t));
  603|  7.31k|    if (!l_t2) {
  ------------------
  |  Branch (603:9): [True: 0, False: 7.31k]
  ------------------
  604|      0|        return NULL;
  605|      0|    }
  606|       |
  607|  7.31k|    l_t2->image = p_image;
  608|  7.31k|    l_t2->cp = p_cp;
  609|       |
  610|  7.31k|    return l_t2;
  611|  7.31k|}
opj_t2_destroy:
  614|  7.31k|{
  615|  7.31k|    if (t2) {
  ------------------
  |  Branch (615:9): [True: 7.31k, False: 0]
  ------------------
  616|  7.31k|        opj_free(t2);
  617|  7.31k|    }
  618|  7.31k|}
t2.c:opj_null_jas_fprintf:
  386|  68.7M|{
  387|  68.7M|    (void)file;
  388|  68.7M|    (void)format;
  389|  68.7M|}
t2.c:opj_t2_decode_packet:
  629|  17.6M|{
  630|  17.6M|    OPJ_BOOL l_read_data;
  631|  17.6M|    OPJ_UINT32 l_nb_bytes_read = 0;
  632|  17.6M|    OPJ_UINT32 l_nb_total_bytes_read = 0;
  633|       |
  634|  17.6M|    *p_data_read = 0;
  635|       |
  636|  17.6M|    if (! opj_t2_read_packet_header(p_t2, p_tile, p_tcp, p_pi, &l_read_data, p_src,
  ------------------
  |  Branch (636:9): [True: 4.92k, False: 17.6M]
  ------------------
  637|  17.6M|                                    &l_nb_bytes_read, p_max_length, p_pack_info, p_manager)) {
  638|  4.92k|        return OPJ_FALSE;
  ------------------
  |  |  118|  4.92k|#define OPJ_FALSE 0
  ------------------
  639|  4.92k|    }
  640|       |
  641|  17.6M|    p_src += l_nb_bytes_read;
  642|  17.6M|    l_nb_total_bytes_read += l_nb_bytes_read;
  643|  17.6M|    p_max_length -= l_nb_bytes_read;
  644|       |
  645|       |    /* we should read data for the packet */
  646|  17.6M|    if (l_read_data) {
  ------------------
  |  Branch (646:9): [True: 18.9k, False: 17.6M]
  ------------------
  647|  18.9k|        l_nb_bytes_read = 0;
  648|       |
  649|  18.9k|        if (! opj_t2_read_packet_data(p_t2, p_tile, p_pi, p_src, &l_nb_bytes_read,
  ------------------
  |  Branch (649:13): [True: 80, False: 18.8k]
  ------------------
  650|  18.9k|                                      p_max_length, p_pack_info, p_manager)) {
  651|     80|            return OPJ_FALSE;
  ------------------
  |  |  118|     80|#define OPJ_FALSE 0
  ------------------
  652|     80|        }
  653|       |
  654|  18.8k|        l_nb_total_bytes_read += l_nb_bytes_read;
  655|  18.8k|    }
  656|       |
  657|  17.6M|    *p_data_read = l_nb_total_bytes_read;
  658|       |
  659|  17.6M|    return OPJ_TRUE;
  ------------------
  |  |  117|  17.6M|#define OPJ_TRUE 1
  ------------------
  660|  17.6M|}
t2.c:opj_t2_read_packet_header:
 1061|  33.1M|{
 1062|       |    /* loop */
 1063|  33.1M|    OPJ_UINT32 bandno, cblkno;
 1064|  33.1M|    OPJ_UINT32 l_nb_code_blocks;
 1065|  33.1M|    OPJ_UINT32 l_remaining_length;
 1066|  33.1M|    OPJ_UINT32 l_header_length;
 1067|  33.1M|    OPJ_UINT32 * l_modified_length_ptr = 00;
 1068|  33.1M|    OPJ_BYTE *l_current_data = p_src_data;
 1069|  33.1M|    opj_cp_t *l_cp = p_t2->cp;
 1070|  33.1M|    opj_bio_t *l_bio = 00;  /* BIO component */
 1071|  33.1M|    opj_tcd_band_t *l_band = 00;
 1072|  33.1M|    opj_tcd_cblk_dec_t* l_cblk = 00;
 1073|  33.1M|    opj_tcd_resolution_t* l_res =
 1074|  33.1M|        &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
 1075|       |
 1076|  33.1M|    OPJ_BYTE *l_header_data = 00;
 1077|  33.1M|    OPJ_BYTE **l_header_data_start = 00;
 1078|       |
 1079|  33.1M|    OPJ_UINT32 l_present;
 1080|       |
 1081|  33.1M|    if (p_pi->layno == 0) {
  ------------------
  |  Branch (1081:9): [True: 431k, False: 32.7M]
  ------------------
 1082|   431k|        l_band = l_res->bands;
 1083|       |
 1084|       |        /* reset tagtrees */
 1085|  1.13M|        for (bandno = 0; bandno < l_res->numbands; ++bandno) {
  ------------------
  |  Branch (1085:26): [True: 705k, False: 431k]
  ------------------
 1086|   705k|            if (!opj_tcd_is_band_empty(l_band)) {
  ------------------
  |  Branch (1086:17): [True: 601k, False: 103k]
  ------------------
 1087|   601k|                opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
 1088|   601k|                if (!(p_pi->precno < (l_band->precincts_data_size / sizeof(
  ------------------
  |  Branch (1088:21): [True: 0, False: 601k]
  ------------------
 1089|   601k|                                          opj_tcd_precinct_t)))) {
 1090|      0|                    opj_event_msg(p_manager, EVT_ERROR, "Invalid precinct\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1091|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1092|      0|                }
 1093|       |
 1094|       |
 1095|   601k|                opj_tgt_reset(l_prc->incltree);
 1096|   601k|                opj_tgt_reset(l_prc->imsbtree);
 1097|   601k|                l_cblk = l_prc->cblks.dec;
 1098|       |
 1099|   601k|                l_nb_code_blocks = l_prc->cw * l_prc->ch;
 1100|  98.1M|                for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (1100:34): [True: 97.5M, False: 601k]
  ------------------
 1101|  97.5M|                    l_cblk->numsegs = 0;
 1102|  97.5M|                    l_cblk->real_num_segs = 0;
 1103|  97.5M|                    ++l_cblk;
 1104|  97.5M|                }
 1105|   601k|            }
 1106|       |
 1107|   705k|            ++l_band;
 1108|   705k|        }
 1109|   431k|    }
 1110|       |
 1111|       |    /* SOP markers */
 1112|       |
 1113|  33.1M|    if (p_tcp->csty & J2K_CP_CSTY_SOP) {
  ------------------
  |  |   55|  33.1M|#define J2K_CP_CSTY_SOP 0x02
  ------------------
  |  Branch (1113:9): [True: 1.04M, False: 32.1M]
  ------------------
 1114|       |        /* SOP markers are allowed (i.e. optional), just warn */
 1115|  1.04M|        if (p_max_length < 6) {
  ------------------
  |  Branch (1115:13): [True: 1.02M, False: 13.1k]
  ------------------
 1116|  1.02M|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  1.02M|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1117|  1.02M|                          "Not enough space for expected SOP marker\n");
 1118|  1.02M|        } else if ((*l_current_data) != 0xff || (*(l_current_data + 1) != 0x91)) {
  ------------------
  |  Branch (1118:20): [True: 6.52k, False: 6.62k]
  |  Branch (1118:49): [True: 97, False: 6.52k]
  ------------------
 1119|  6.61k|            opj_event_msg(p_manager, EVT_WARNING, "Expected SOP marker\n");
  ------------------
  |  |   67|  6.61k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1120|  6.61k|        } else {
 1121|  6.52k|            l_current_data += 6;
 1122|  6.52k|        }
 1123|       |
 1124|       |        /** TODO : check the Nsop value */
 1125|  1.04M|    }
 1126|       |
 1127|       |    /*
 1128|       |    When the marker PPT/PPM is used the packet header are store in PPT/PPM marker
 1129|       |    This part deal with this characteristic
 1130|       |    step 1: Read packet header in the saved structure
 1131|       |    step 2: Return to codestream for decoding
 1132|       |    */
 1133|       |
 1134|  33.1M|    l_bio = opj_bio_create();
 1135|  33.1M|    if (! l_bio) {
  ------------------
  |  Branch (1135:9): [True: 0, False: 33.1M]
  ------------------
 1136|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1137|      0|    }
 1138|       |
 1139|  33.1M|    if (l_cp->ppm == 1) { /* PPM */
  ------------------
  |  Branch (1139:9): [True: 11, False: 33.1M]
  ------------------
 1140|     11|        l_header_data_start = &l_cp->ppm_data;
 1141|     11|        l_header_data = *l_header_data_start;
 1142|     11|        l_modified_length_ptr = &(l_cp->ppm_len);
 1143|       |
 1144|  33.1M|    } else if (p_tcp->ppt == 1) { /* PPT */
  ------------------
  |  Branch (1144:16): [True: 71, False: 33.1M]
  ------------------
 1145|     71|        l_header_data_start = &(p_tcp->ppt_data);
 1146|     71|        l_header_data = *l_header_data_start;
 1147|     71|        l_modified_length_ptr = &(p_tcp->ppt_len);
 1148|  33.1M|    } else { /* Normal Case */
 1149|  33.1M|        l_header_data_start = &(l_current_data);
 1150|  33.1M|        l_header_data = *l_header_data_start;
 1151|  33.1M|        l_remaining_length = (OPJ_UINT32)(p_src_data + p_max_length - l_header_data);
 1152|  33.1M|        l_modified_length_ptr = &(l_remaining_length);
 1153|  33.1M|    }
 1154|       |
 1155|  33.1M|    opj_bio_init_dec(l_bio, l_header_data, *l_modified_length_ptr);
 1156|       |
 1157|  33.1M|    l_present = opj_bio_read(l_bio, 1);
 1158|  33.1M|    JAS_FPRINTF(stderr, "present=%d \n", l_present);
  ------------------
  |  |  390|  33.1M|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1159|  33.1M|    if (!l_present) {
  ------------------
  |  Branch (1159:9): [True: 33.1M, False: 25.4k]
  ------------------
 1160|       |        /* TODO MSD: no test to control the output of this function*/
 1161|  33.1M|        opj_bio_inalign(l_bio);
 1162|  33.1M|        l_header_data += opj_bio_numbytes(l_bio);
 1163|  33.1M|        opj_bio_destroy(l_bio);
 1164|       |
 1165|       |        /* EPH markers */
 1166|  33.1M|        if (p_tcp->csty & J2K_CP_CSTY_EPH) {
  ------------------
  |  |   56|  33.1M|#define J2K_CP_CSTY_EPH 0x04
  ------------------
  |  Branch (1166:13): [True: 746, False: 33.1M]
  ------------------
 1167|       |            /* EPH markers are required */
 1168|    746|            if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data -
  ------------------
  |  Branch (1168:17): [True: 6, False: 740]
  ------------------
 1169|    746|                    *l_header_data_start)) < 2U) {
 1170|      6|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1171|      6|                              "Not enough space for required EPH marker\n");
 1172|      6|                return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 1173|    740|            } else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
  ------------------
  |  Branch (1173:24): [True: 647, False: 93]
  |  Branch (1173:52): [True: 66, False: 27]
  ------------------
 1174|    713|                opj_event_msg(p_manager, EVT_ERROR, "Expected EPH marker\n");
  ------------------
  |  |   66|    713|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1175|    713|                return OPJ_FALSE;
  ------------------
  |  |  118|    713|#define OPJ_FALSE 0
  ------------------
 1176|    713|            } else {
 1177|     27|                l_header_data += 2;
 1178|     27|            }
 1179|    746|        }
 1180|       |
 1181|  33.1M|        l_header_length = (OPJ_UINT32)(l_header_data - *l_header_data_start);
 1182|  33.1M|        *l_modified_length_ptr -= l_header_length;
 1183|  33.1M|        *l_header_data_start += l_header_length;
 1184|       |
 1185|       |        /* << INDEX */
 1186|       |        /* End of packet header position. Currently only represents the distance to start of packet
 1187|       |           Will be updated later by incrementing with packet start value */
 1188|  33.1M|        if (p_pack_info) {
  ------------------
  |  Branch (1188:13): [True: 0, False: 33.1M]
  ------------------
 1189|      0|            p_pack_info->end_ph_pos = (OPJ_INT32)(l_current_data - p_src_data);
 1190|      0|        }
 1191|       |        /* INDEX >> */
 1192|       |
 1193|  33.1M|        * p_is_data_present = OPJ_FALSE;
  ------------------
  |  |  118|  33.1M|#define OPJ_FALSE 0
  ------------------
 1194|  33.1M|        *p_data_read = (OPJ_UINT32)(l_current_data - p_src_data);
 1195|  33.1M|        return OPJ_TRUE;
  ------------------
  |  |  117|  33.1M|#define OPJ_TRUE 1
  ------------------
 1196|  33.1M|    }
 1197|       |
 1198|  25.4k|    l_band = l_res->bands;
 1199|  79.4k|    for (bandno = 0; bandno < l_res->numbands; ++bandno, ++l_band) {
  ------------------
  |  Branch (1199:22): [True: 53.9k, False: 25.4k]
  ------------------
 1200|  53.9k|        opj_tcd_precinct_t *l_prc = &(l_band->precincts[p_pi->precno]);
 1201|       |
 1202|  53.9k|        if (opj_tcd_is_band_empty(l_band)) {
  ------------------
  |  Branch (1202:13): [True: 13.4k, False: 40.5k]
  ------------------
 1203|  13.4k|            continue;
 1204|  13.4k|        }
 1205|       |
 1206|  40.5k|        l_nb_code_blocks = l_prc->cw * l_prc->ch;
 1207|  40.5k|        l_cblk = l_prc->cblks.dec;
 1208|  2.39M|        for (cblkno = 0; cblkno < l_nb_code_blocks; cblkno++) {
  ------------------
  |  Branch (1208:26): [True: 2.35M, False: 40.5k]
  ------------------
 1209|  2.35M|            OPJ_UINT32 l_included, l_increment, l_segno;
 1210|  2.35M|            OPJ_INT32 n;
 1211|       |
 1212|       |            /* if cblk not yet included before --> inclusion tagtree */
 1213|  2.35M|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1213:17): [True: 2.30M, False: 48.9k]
  ------------------
 1214|  2.30M|                l_included = opj_tgt_decode(l_bio, l_prc->incltree, cblkno,
 1215|  2.30M|                                            (OPJ_INT32)(p_pi->layno + 1));
 1216|       |                /* else one bit */
 1217|  2.30M|            } else {
 1218|  48.9k|                l_included = opj_bio_read(l_bio, 1);
 1219|  48.9k|            }
 1220|       |
 1221|       |            /* if cblk not included */
 1222|  2.35M|            if (!l_included) {
  ------------------
  |  Branch (1222:17): [True: 2.29M, False: 61.9k]
  ------------------
 1223|  2.29M|                l_cblk->numnewpasses = 0;
 1224|  2.29M|                ++l_cblk;
 1225|  2.29M|                JAS_FPRINTF(stderr, "included=%d \n", l_included);
  ------------------
  |  |  390|  2.29M|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1226|  2.29M|                continue;
 1227|  2.29M|            }
 1228|       |
 1229|       |            /* if cblk not yet included --> zero-bitplane tagtree */
 1230|  61.9k|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1230:17): [True: 19.6k, False: 42.3k]
  ------------------
 1231|  19.6k|                OPJ_UINT32 i = 0;
 1232|       |
 1233|   279k|                while (!opj_tgt_decode(l_bio, l_prc->imsbtree, cblkno, (OPJ_INT32)i)) {
  ------------------
  |  Branch (1233:24): [True: 259k, False: 19.6k]
  ------------------
 1234|   259k|                    ++i;
 1235|   259k|                }
 1236|  19.6k|                l_cblk->Mb = (OPJ_UINT32)l_band->numbps;
 1237|  19.6k|                if ((OPJ_UINT32)l_band->numbps + 1 < i) {
  ------------------
  |  Branch (1237:21): [True: 2.13k, False: 17.4k]
  ------------------
 1238|       |                    /* Not totally sure what we should do in that situation,
 1239|       |                     * but that avoids the integer overflow of
 1240|       |                     * https://github.com/uclouvain/openjpeg/pull/1488
 1241|       |                     * while keeping the regression test suite happy.
 1242|       |                     */
 1243|  2.13k|                    l_cblk->numbps = (OPJ_UINT32)(l_band->numbps + 1 - (int)i);
 1244|  17.4k|                } else {
 1245|  17.4k|                    l_cblk->numbps = (OPJ_UINT32)l_band->numbps + 1 - i;
 1246|  17.4k|                }
 1247|  19.6k|                l_cblk->numlenbits = 3;
 1248|  19.6k|            }
 1249|       |
 1250|       |            /* number of coding passes */
 1251|  61.9k|            l_cblk->numnewpasses = opj_t2_getnumpasses(l_bio);
 1252|  61.9k|            l_increment = opj_t2_getcommacode(l_bio);
 1253|       |
 1254|       |            /* length indicator increment */
 1255|  61.9k|            l_cblk->numlenbits += l_increment;
 1256|  61.9k|            l_segno = 0;
 1257|       |
 1258|  61.9k|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1258:17): [True: 19.6k, False: 42.3k]
  ------------------
 1259|  19.6k|                if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 1)) {
  ------------------
  |  Branch (1259:21): [True: 0, False: 19.6k]
  ------------------
 1260|      0|                    opj_bio_destroy(l_bio);
 1261|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1262|      0|                }
 1263|  42.3k|            } else {
 1264|  42.3k|                l_segno = l_cblk->numsegs - 1;
 1265|  42.3k|                if (l_cblk->segs[l_segno].numpasses == l_cblk->segs[l_segno].maxpasses) {
  ------------------
  |  Branch (1265:21): [True: 4.16k, False: 38.1k]
  ------------------
 1266|  4.16k|                    ++l_segno;
 1267|  4.16k|                    if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) {
  ------------------
  |  Branch (1267:25): [True: 0, False: 4.16k]
  ------------------
 1268|      0|                        opj_bio_destroy(l_bio);
 1269|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1270|      0|                    }
 1271|  4.16k|                }
 1272|  42.3k|            }
 1273|  61.9k|            n = (OPJ_INT32)l_cblk->numnewpasses;
 1274|       |
 1275|  61.9k|            if ((p_tcp->tccps[p_pi->compno].cblksty & J2K_CCP_CBLKSTY_HT) != 0)
  ------------------
  |  |   64|  61.9k|#define J2K_CCP_CBLKSTY_HT 0x40       /**< (high throughput) HT codeblocks */
  ------------------
  |  Branch (1275:17): [True: 2.35k, False: 59.5k]
  ------------------
 1276|  3.97k|                do {
 1277|  3.97k|                    OPJ_UINT32 bit_number;
 1278|  3.97k|                    l_cblk->segs[l_segno].numnewpasses = l_segno == 0 ? 1 : (OPJ_UINT32)n;
  ------------------
  |  Branch (1278:58): [True: 2.27k, False: 1.69k]
  ------------------
 1279|  3.97k|                    bit_number = l_cblk->numlenbits + opj_uint_floorlog2(
 1280|  3.97k|                                     l_cblk->segs[l_segno].numnewpasses);
 1281|  3.97k|                    if (bit_number > 32) {
  ------------------
  |  Branch (1281:25): [True: 0, False: 3.97k]
  ------------------
 1282|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1283|      0|                                      "Invalid bit number %d in opj_t2_read_packet_header()\n",
 1284|      0|                                      bit_number);
 1285|      0|                        opj_bio_destroy(l_bio);
 1286|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1287|      0|                    }
 1288|  3.97k|                    l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, bit_number);
 1289|  3.97k|                    JAS_FPRINTF(stderr, "included=%d numnewpasses=%d increment=%d len=%d \n",
  ------------------
  |  |  390|  3.97k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1290|  3.97k|                                l_included, l_cblk->segs[l_segno].numnewpasses, l_increment,
 1291|  3.97k|                                l_cblk->segs[l_segno].newlen);
 1292|       |
 1293|  3.97k|                    n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses;
 1294|  3.97k|                    if (n > 0) {
  ------------------
  |  Branch (1294:25): [True: 1.61k, False: 2.35k]
  ------------------
 1295|  1.61k|                        ++l_segno;
 1296|       |
 1297|  1.61k|                        if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) {
  ------------------
  |  Branch (1297:29): [True: 0, False: 1.61k]
  ------------------
 1298|      0|                            opj_bio_destroy(l_bio);
 1299|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1300|      0|                        }
 1301|  1.61k|                    }
 1302|  3.97k|                } while (n > 0);
  ------------------
  |  Branch (1302:26): [True: 1.61k, False: 2.35k]
  ------------------
 1303|  59.5k|            else
 1304|  69.8k|                do {
 1305|  69.8k|                    OPJ_UINT32 bit_number;
 1306|  69.8k|                    l_cblk->segs[l_segno].numnewpasses = (OPJ_UINT32)opj_int_min((OPJ_INT32)(
 1307|  69.8k|                            l_cblk->segs[l_segno].maxpasses - l_cblk->segs[l_segno].numpasses), n);
 1308|  69.8k|                    bit_number = l_cblk->numlenbits + opj_uint_floorlog2(
 1309|  69.8k|                                     l_cblk->segs[l_segno].numnewpasses);
 1310|  69.8k|                    if (bit_number > 32) {
  ------------------
  |  Branch (1310:25): [True: 6, False: 69.8k]
  ------------------
 1311|      6|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1312|      6|                                      "Invalid bit number %d in opj_t2_read_packet_header()\n",
 1313|      6|                                      bit_number);
 1314|      6|                        opj_bio_destroy(l_bio);
 1315|      6|                        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 1316|      6|                    }
 1317|  69.8k|                    l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, bit_number);
 1318|  69.8k|                    JAS_FPRINTF(stderr, "included=%d numnewpasses=%d increment=%d len=%d \n",
  ------------------
  |  |  390|  69.8k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1319|  69.8k|                                l_included, l_cblk->segs[l_segno].numnewpasses, l_increment,
 1320|  69.8k|                                l_cblk->segs[l_segno].newlen);
 1321|       |
 1322|  69.8k|                    n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses;
 1323|  69.8k|                    if (n > 0) {
  ------------------
  |  Branch (1323:25): [True: 10.2k, False: 59.5k]
  ------------------
 1324|  10.2k|                        ++l_segno;
 1325|       |
 1326|  10.2k|                        if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) {
  ------------------
  |  Branch (1326:29): [True: 0, False: 10.2k]
  ------------------
 1327|      0|                            opj_bio_destroy(l_bio);
 1328|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1329|      0|                        }
 1330|  10.2k|                    }
 1331|  69.8k|                } while (n > 0);
  ------------------
  |  Branch (1331:26): [True: 10.2k, False: 59.5k]
  ------------------
 1332|       |
 1333|  61.9k|            ++l_cblk;
 1334|  61.9k|        }
 1335|  40.5k|    }
 1336|       |
 1337|  25.4k|    if (!opj_bio_inalign(l_bio)) {
  ------------------
  |  Branch (1337:9): [True: 2, False: 25.4k]
  ------------------
 1338|      2|        opj_bio_destroy(l_bio);
 1339|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 1340|      2|    }
 1341|       |
 1342|  25.4k|    l_header_data += opj_bio_numbytes(l_bio);
 1343|  25.4k|    opj_bio_destroy(l_bio);
 1344|       |
 1345|       |    /* EPH markers */
 1346|  25.4k|    if (p_tcp->csty & J2K_CP_CSTY_EPH) {
  ------------------
  |  |   56|  25.4k|#define J2K_CP_CSTY_EPH 0x04
  ------------------
  |  Branch (1346:9): [True: 10.6k, False: 14.8k]
  ------------------
 1347|       |        /* EPH markers are required */
 1348|  10.6k|        if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data -
  ------------------
  |  Branch (1348:13): [True: 83, False: 10.5k]
  ------------------
 1349|  10.6k|                *l_header_data_start)) < 2U) {
 1350|     83|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     83|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1351|     83|                          "Not enough space for required EPH marker\n");
 1352|     83|            return OPJ_FALSE;
  ------------------
  |  |  118|     83|#define OPJ_FALSE 0
  ------------------
 1353|  10.5k|        } else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
  ------------------
  |  Branch (1353:20): [True: 3.87k, False: 6.71k]
  |  Branch (1353:48): [True: 251, False: 6.46k]
  ------------------
 1354|  4.12k|            opj_event_msg(p_manager, EVT_ERROR, "Expected EPH marker\n");
  ------------------
  |  |   66|  4.12k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1355|  4.12k|            return OPJ_FALSE;
  ------------------
  |  |  118|  4.12k|#define OPJ_FALSE 0
  ------------------
 1356|  6.46k|        } else {
 1357|  6.46k|            l_header_data += 2;
 1358|  6.46k|        }
 1359|  10.6k|    }
 1360|       |
 1361|  21.2k|    l_header_length = (OPJ_UINT32)(l_header_data - *l_header_data_start);
 1362|  21.2k|    JAS_FPRINTF(stderr, "hdrlen=%d \n", l_header_length);
  ------------------
  |  |  390|  21.2k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1363|  21.2k|    if (!l_header_length) {
  ------------------
  |  Branch (1363:9): [True: 0, False: 21.2k]
  ------------------
 1364|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1365|      0|    }
 1366|  21.2k|    JAS_FPRINTF(stderr, "packet body\n");
  ------------------
  |  |  390|  21.2k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1367|  21.2k|    *l_modified_length_ptr -= l_header_length;
 1368|  21.2k|    *l_header_data_start += l_header_length;
 1369|       |
 1370|       |    /* << INDEX */
 1371|       |    /* End of packet header position. Currently only represents the distance to start of packet
 1372|       |     Will be updated later by incrementing with packet start value */
 1373|  21.2k|    if (p_pack_info) {
  ------------------
  |  Branch (1373:9): [True: 0, False: 21.2k]
  ------------------
 1374|      0|        p_pack_info->end_ph_pos = (OPJ_INT32)(l_current_data - p_src_data);
 1375|      0|    }
 1376|       |    /* INDEX >> */
 1377|       |
 1378|  21.2k|    *p_is_data_present = OPJ_TRUE;
  ------------------
  |  |  117|  21.2k|#define OPJ_TRUE 1
  ------------------
 1379|  21.2k|    *p_data_read = (OPJ_UINT32)(l_current_data - p_src_data);
 1380|       |
 1381|  21.2k|    return OPJ_TRUE;
  ------------------
  |  |  117|  21.2k|#define OPJ_TRUE 1
  ------------------
 1382|  21.2k|}
t2.c:opj_t2_getnumpasses:
  200|  61.9k|{
  201|  61.9k|    OPJ_UINT32 n;
  202|  61.9k|    if (!opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (202:9): [True: 22.1k, False: 39.7k]
  ------------------
  203|  22.1k|        return 1;
  204|  22.1k|    }
  205|  39.7k|    if (!opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (205:9): [True: 23.4k, False: 16.3k]
  ------------------
  206|  23.4k|        return 2;
  207|  23.4k|    }
  208|  16.3k|    if ((n = opj_bio_read(bio, 2)) != 3) {
  ------------------
  |  Branch (208:9): [True: 12.1k, False: 4.20k]
  ------------------
  209|  12.1k|        return (3 + n);
  210|  12.1k|    }
  211|  4.20k|    if ((n = opj_bio_read(bio, 5)) != 31) {
  ------------------
  |  Branch (211:9): [True: 3.99k, False: 209]
  ------------------
  212|  3.99k|        return (6 + n);
  213|  3.99k|    }
  214|    209|    return (37 + opj_bio_read(bio, 7));
  215|  4.20k|}
t2.c:opj_t2_getcommacode:
  176|  61.9k|{
  177|  61.9k|    OPJ_UINT32 n = 0;
  178|  77.5k|    while (opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (178:12): [True: 15.6k, False: 61.9k]
  ------------------
  179|  15.6k|        ++n;
  180|  15.6k|    }
  181|  61.9k|    return n;
  182|  61.9k|}
t2.c:opj_t2_init_seg:
 1663|  35.6k|{
 1664|  35.6k|    opj_tcd_seg_t* seg = 00;
 1665|  35.6k|    OPJ_UINT32 l_nb_segs = index + 1;
 1666|       |
 1667|  35.6k|    if (l_nb_segs > cblk->m_current_max_segs) {
  ------------------
  |  Branch (1667:9): [True: 1.05k, False: 34.6k]
  ------------------
 1668|  1.05k|        opj_tcd_seg_t* new_segs;
 1669|  1.05k|        OPJ_UINT32 l_m_current_max_segs = cblk->m_current_max_segs +
 1670|  1.05k|                                          OPJ_J2K_DEFAULT_NB_SEGS;
  ------------------
  |  |  157|  1.05k|#define OPJ_J2K_DEFAULT_NB_SEGS             10
  ------------------
 1671|       |
 1672|  1.05k|        new_segs = (opj_tcd_seg_t*) opj_realloc(cblk->segs,
 1673|  1.05k|                                                l_m_current_max_segs * sizeof(opj_tcd_seg_t));
 1674|  1.05k|        if (! new_segs) {
  ------------------
  |  Branch (1674:13): [True: 0, False: 1.05k]
  ------------------
 1675|       |            /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to initialize segment %d\n", l_nb_segs); */
 1676|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1677|      0|        }
 1678|  1.05k|        cblk->segs = new_segs;
 1679|  1.05k|        memset(new_segs + cblk->m_current_max_segs,
 1680|  1.05k|               0, OPJ_J2K_DEFAULT_NB_SEGS * sizeof(opj_tcd_seg_t));
  ------------------
  |  |  157|  1.05k|#define OPJ_J2K_DEFAULT_NB_SEGS             10
  ------------------
 1681|  1.05k|        cblk->m_current_max_segs = l_m_current_max_segs;
 1682|  1.05k|    }
 1683|       |
 1684|  35.6k|    seg = &cblk->segs[index];
 1685|  35.6k|    opj_tcd_reinit_segment(seg);
 1686|       |
 1687|  35.6k|    if (cblksty & J2K_CCP_CBLKSTY_TERMALL) {
  ------------------
  |  |   60|  35.6k|#define J2K_CCP_CBLKSTY_TERMALL 0x04  /**< Termination on each coding pass */
  ------------------
  |  Branch (1687:9): [True: 11.3k, False: 24.3k]
  ------------------
 1688|  11.3k|        seg->maxpasses = 1;
 1689|  24.3k|    } else if (cblksty & J2K_CCP_CBLKSTY_LAZY) {
  ------------------
  |  |   58|  24.3k|#define J2K_CCP_CBLKSTY_LAZY 0x01     /**< Selective arithmetic coding bypass */
  ------------------
  |  Branch (1689:16): [True: 10.6k, False: 13.7k]
  ------------------
 1690|  10.6k|        if (first) {
  ------------------
  |  Branch (1690:13): [True: 3.73k, False: 6.87k]
  ------------------
 1691|  3.73k|            seg->maxpasses = 10;
 1692|  6.87k|        } else {
 1693|  6.87k|            seg->maxpasses = (((seg - 1)->maxpasses == 1) ||
  ------------------
  |  Branch (1693:31): [True: 2.97k, False: 3.90k]
  ------------------
 1694|  6.87k|                              ((seg - 1)->maxpasses == 10)) ? 2 : 1;
  ------------------
  |  Branch (1694:31): [True: 722, False: 3.17k]
  ------------------
 1695|  6.87k|        }
 1696|  13.7k|    } else {
 1697|       |        /* See paragraph "B.10.6 Number of coding passes" of the standard.
 1698|       |         * Probably that 109 must be interpreted a (Mb-1)*3 + 1 with Mb=37,
 1699|       |         * Mb being the maximum number of bit-planes available for the
 1700|       |         * representation of coefficients in the sub-band */
 1701|  13.7k|        seg->maxpasses = 109;
 1702|  13.7k|    }
 1703|       |
 1704|  35.6k|    return OPJ_TRUE;
  ------------------
  |  |  117|  35.6k|#define OPJ_TRUE 1
  ------------------
 1705|  35.6k|}
t2.c:opj_t2_read_packet_data:
 1392|  18.9k|{
 1393|  18.9k|    OPJ_UINT32 bandno, cblkno;
 1394|  18.9k|    OPJ_UINT32 l_nb_code_blocks;
 1395|  18.9k|    OPJ_BYTE *l_current_data = p_src_data;
 1396|  18.9k|    opj_tcd_band_t *l_band = 00;
 1397|  18.9k|    opj_tcd_cblk_dec_t* l_cblk = 00;
 1398|  18.9k|    opj_tcd_resolution_t* l_res =
 1399|  18.9k|        &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
 1400|  18.9k|    OPJ_BOOL partial_buffer = OPJ_FALSE;
  ------------------
  |  |  118|  18.9k|#define OPJ_FALSE 0
  ------------------
 1401|       |
 1402|  18.9k|    OPJ_ARG_NOT_USED(p_t2);
  ------------------
  |  |  144|  18.9k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1403|  18.9k|    OPJ_ARG_NOT_USED(pack_info);
  ------------------
  |  |  144|  18.9k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1404|       |
 1405|  18.9k|    l_band = l_res->bands;
 1406|  61.7k|    for (bandno = 0; bandno < l_res->numbands; ++bandno) {
  ------------------
  |  Branch (1406:22): [True: 42.8k, False: 18.8k]
  ------------------
 1407|  42.8k|        opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
 1408|       |
 1409|  42.8k|        if ((l_band->x1 - l_band->x0 == 0) || (l_band->y1 - l_band->y0 == 0)) {
  ------------------
  |  Branch (1409:13): [True: 2.81k, False: 40.0k]
  |  Branch (1409:47): [True: 6.85k, False: 33.1k]
  ------------------
 1410|  9.67k|            ++l_band;
 1411|  9.67k|            continue;
 1412|  9.67k|        }
 1413|       |
 1414|  33.1k|        l_nb_code_blocks = l_prc->cw * l_prc->ch;
 1415|  33.1k|        l_cblk = l_prc->cblks.dec;
 1416|       |
 1417|  1.40M|        for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno, ++l_cblk) {
  ------------------
  |  Branch (1417:26): [True: 1.36M, False: 33.1k]
  ------------------
 1418|  1.36M|            opj_tcd_seg_t *l_seg = 00;
 1419|       |
 1420|  1.36M|            if (!l_cblk->numnewpasses) {
  ------------------
  |  Branch (1420:17): [True: 1.31M, False: 54.5k]
  ------------------
 1421|       |                /* nothing to do */
 1422|  1.31M|                continue;
 1423|  1.31M|            }
 1424|       |
 1425|  54.5k|            if (partial_buffer || l_cblk->corrupted) {
  ------------------
  |  Branch (1425:17): [True: 0, False: 54.5k]
  |  Branch (1425:35): [True: 0, False: 54.5k]
  ------------------
 1426|       |                /* if a previous segment in this packet couldn't be decoded,
 1427|       |                 * or if this code block was corrupted in a previous layer,
 1428|       |                 * then mark it as corrupted.
 1429|       |                 */
 1430|      0|                l_cblk->numchunks = 0;
 1431|      0|                l_cblk->corrupted = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1432|      0|                continue;
 1433|      0|            }
 1434|       |
 1435|  54.5k|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1435:17): [True: 12.7k, False: 41.7k]
  ------------------
 1436|  12.7k|                l_seg = l_cblk->segs;
 1437|  12.7k|                ++l_cblk->numsegs;
 1438|  41.7k|            } else {
 1439|  41.7k|                l_seg = &l_cblk->segs[l_cblk->numsegs - 1];
 1440|       |
 1441|  41.7k|                if (l_seg->numpasses == l_seg->maxpasses) {
  ------------------
  |  Branch (1441:21): [True: 3.93k, False: 37.8k]
  ------------------
 1442|  3.93k|                    ++l_seg;
 1443|  3.93k|                    ++l_cblk->numsegs;
 1444|  3.93k|                }
 1445|  41.7k|            }
 1446|       |
 1447|  62.1k|            do {
 1448|       |                /* Check possible overflow (on l_current_data only, assumes input args already checked) then size */
 1449|  62.1k|                if ((((OPJ_SIZE_T)l_current_data + (OPJ_SIZE_T)l_seg->newlen) <
  ------------------
  |  Branch (1449:21): [True: 0, False: 62.1k]
  ------------------
 1450|  62.1k|                        (OPJ_SIZE_T)l_current_data) ||
 1451|  62.1k|                        (l_current_data + l_seg->newlen > p_src_data + p_max_length) ||
  ------------------
  |  Branch (1451:25): [True: 80, False: 62.0k]
  ------------------
 1452|  62.1k|                        (partial_buffer)) {
  ------------------
  |  Branch (1452:25): [True: 0, False: 62.0k]
  ------------------
 1453|     80|                    if (p_t2->cp->strict) {
  ------------------
  |  Branch (1453:25): [True: 80, False: 0]
  ------------------
 1454|     80|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     80|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1455|     80|                                      "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1456|     80|                                      l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
 1457|     80|                                      p_pi->compno);
 1458|     80|                        return OPJ_FALSE;
  ------------------
  |  |  118|     80|#define OPJ_FALSE 0
  ------------------
 1459|     80|                    } else {
 1460|      0|                        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1461|      0|                                      "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1462|      0|                                      l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
 1463|      0|                                      p_pi->compno);
 1464|       |                        /* skip this codeblock (and following ones in this
 1465|       |                         * packet) since it is a partial read
 1466|       |                         */
 1467|      0|                        partial_buffer = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1468|      0|                        l_cblk->corrupted = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1469|      0|                        l_cblk->numchunks = 0;
 1470|      0|                        break;
 1471|      0|                    }
 1472|     80|                }
 1473|       |
 1474|       |#ifdef USE_JPWL
 1475|       |                /* we need here a j2k handle to verify if making a check to
 1476|       |                the validity of cblocks parameters is selected from user (-W) */
 1477|       |
 1478|       |                /* let's check that we are not exceeding */
 1479|       |                if ((l_cblk->len + l_seg->newlen) > 8192) {
 1480|       |                    opj_event_msg(p_manager, EVT_WARNING,
 1481|       |                                  "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1482|       |                                  l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
 1483|       |                    if (!JPWL_ASSUME) {
 1484|       |                        opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 1485|       |                        return OPJ_FALSE;
 1486|       |                    }
 1487|       |                    l_seg->newlen = 8192 - l_cblk->len;
 1488|       |                    opj_event_msg(p_manager, EVT_WARNING, "      - truncating segment to %d\n",
 1489|       |                                  l_seg->newlen);
 1490|       |                    break;
 1491|       |                };
 1492|       |
 1493|       |#endif /* USE_JPWL */
 1494|       |
 1495|  62.0k|                if (l_cblk->numchunks == l_cblk->numchunksalloc) {
  ------------------
  |  Branch (1495:21): [True: 15.4k, False: 46.6k]
  ------------------
 1496|  15.4k|                    OPJ_UINT32 l_numchunksalloc = l_cblk->numchunksalloc * 2 + 1;
 1497|  15.4k|                    opj_tcd_seg_data_chunk_t* l_chunks =
 1498|  15.4k|                        (opj_tcd_seg_data_chunk_t*)opj_realloc(l_cblk->chunks,
 1499|  15.4k|                                l_numchunksalloc * sizeof(opj_tcd_seg_data_chunk_t));
 1500|  15.4k|                    if (l_chunks == NULL) {
  ------------------
  |  Branch (1500:25): [True: 0, False: 15.4k]
  ------------------
 1501|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1502|      0|                                      "cannot allocate opj_tcd_seg_data_chunk_t* array");
 1503|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1504|      0|                    }
 1505|  15.4k|                    l_cblk->chunks = l_chunks;
 1506|  15.4k|                    l_cblk->numchunksalloc = l_numchunksalloc;
 1507|  15.4k|                }
 1508|       |
 1509|  62.0k|                l_cblk->chunks[l_cblk->numchunks].data = l_current_data;
 1510|  62.0k|                l_cblk->chunks[l_cblk->numchunks].len = l_seg->newlen;
 1511|  62.0k|                l_cblk->numchunks ++;
 1512|       |
 1513|  62.0k|                l_current_data += l_seg->newlen;
 1514|  62.0k|                l_seg->len += l_seg->newlen;
 1515|  62.0k|                l_seg->numpasses += l_seg->numnewpasses;
 1516|  62.0k|                l_cblk->numnewpasses -= l_seg->numnewpasses;
 1517|       |
 1518|  62.0k|                l_seg->real_num_passes = l_seg->numpasses;
 1519|       |
 1520|  62.0k|                if (l_cblk->numnewpasses > 0) {
  ------------------
  |  Branch (1520:21): [True: 7.63k, False: 54.4k]
  ------------------
 1521|  7.63k|                    ++l_seg;
 1522|  7.63k|                    ++l_cblk->numsegs;
 1523|  7.63k|                }
 1524|  62.0k|            } while (l_cblk->numnewpasses > 0);
  ------------------
  |  Branch (1524:22): [True: 7.63k, False: 54.4k]
  ------------------
 1525|       |
 1526|  54.4k|            l_cblk->real_num_segs = l_cblk->numsegs;
 1527|       |
 1528|  54.4k|        } /* next code_block */
 1529|       |
 1530|  33.1k|        ++l_band;
 1531|  33.1k|    }
 1532|       |
 1533|       |    // return the number of bytes read
 1534|  18.8k|    if (partial_buffer) {
  ------------------
  |  Branch (1534:9): [True: 0, False: 18.8k]
  ------------------
 1535|      0|        *(p_data_read) = p_max_length;
 1536|  18.8k|    } else {
 1537|  18.8k|        *(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data);
 1538|  18.8k|    }
 1539|       |
 1540|  18.8k|    return OPJ_TRUE;
  ------------------
  |  |  117|  18.8k|#define OPJ_TRUE 1
  ------------------
 1541|  18.9k|}
t2.c:opj_t2_skip_packet:
 1017|  15.4M|{
 1018|  15.4M|    OPJ_BOOL l_read_data;
 1019|  15.4M|    OPJ_UINT32 l_nb_bytes_read = 0;
 1020|  15.4M|    OPJ_UINT32 l_nb_total_bytes_read = 0;
 1021|       |
 1022|  15.4M|    *p_data_read = 0;
 1023|       |
 1024|  15.4M|    if (! opj_t2_read_packet_header(p_t2, p_tile, p_tcp, p_pi, &l_read_data, p_src,
  ------------------
  |  Branch (1024:9): [True: 5, False: 15.4M]
  ------------------
 1025|  15.4M|                                    &l_nb_bytes_read, p_max_length, p_pack_info, p_manager)) {
 1026|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 1027|      5|    }
 1028|       |
 1029|  15.4M|    p_src += l_nb_bytes_read;
 1030|  15.4M|    l_nb_total_bytes_read += l_nb_bytes_read;
 1031|  15.4M|    p_max_length -= l_nb_bytes_read;
 1032|       |
 1033|       |    /* we should read data for the packet */
 1034|  15.4M|    if (l_read_data) {
  ------------------
  |  Branch (1034:9): [True: 2.33k, False: 15.4M]
  ------------------
 1035|  2.33k|        l_nb_bytes_read = 0;
 1036|       |
 1037|  2.33k|        if (! opj_t2_skip_packet_data(p_t2, p_tile, p_pi, &l_nb_bytes_read,
  ------------------
  |  Branch (1037:13): [True: 36, False: 2.30k]
  ------------------
 1038|  2.33k|                                      p_max_length, p_pack_info, p_manager)) {
 1039|     36|            return OPJ_FALSE;
  ------------------
  |  |  118|     36|#define OPJ_FALSE 0
  ------------------
 1040|     36|        }
 1041|       |
 1042|  2.30k|        l_nb_total_bytes_read += l_nb_bytes_read;
 1043|  2.30k|    }
 1044|  15.4M|    *p_data_read = l_nb_total_bytes_read;
 1045|       |
 1046|  15.4M|    return OPJ_TRUE;
  ------------------
  |  |  117|  15.4M|#define OPJ_TRUE 1
  ------------------
 1047|  15.4M|}
t2.c:opj_t2_skip_packet_data:
 1550|  2.33k|{
 1551|  2.33k|    OPJ_UINT32 bandno, cblkno;
 1552|  2.33k|    OPJ_UINT32 l_nb_code_blocks;
 1553|  2.33k|    opj_tcd_band_t *l_band = 00;
 1554|  2.33k|    opj_tcd_cblk_dec_t* l_cblk = 00;
 1555|  2.33k|    opj_tcd_resolution_t* l_res =
 1556|  2.33k|        &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
 1557|       |
 1558|  2.33k|    OPJ_ARG_NOT_USED(p_t2);
  ------------------
  |  |  144|  2.33k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1559|  2.33k|    OPJ_ARG_NOT_USED(pack_info);
  ------------------
  |  |  144|  2.33k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1560|       |
 1561|  2.33k|    *p_data_read = 0;
 1562|  2.33k|    l_band = l_res->bands;
 1563|       |
 1564|  8.48k|    for (bandno = 0; bandno < l_res->numbands; ++bandno) {
  ------------------
  |  Branch (1564:22): [True: 6.18k, False: 2.30k]
  ------------------
 1565|  6.18k|        opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
 1566|       |
 1567|  6.18k|        if ((l_band->x1 - l_band->x0 == 0) || (l_band->y1 - l_band->y0 == 0)) {
  ------------------
  |  Branch (1567:13): [True: 623, False: 5.56k]
  |  Branch (1567:47): [True: 2.71k, False: 2.84k]
  ------------------
 1568|  3.34k|            ++l_band;
 1569|  3.34k|            continue;
 1570|  3.34k|        }
 1571|       |
 1572|  2.84k|        l_nb_code_blocks = l_prc->cw * l_prc->ch;
 1573|  2.84k|        l_cblk = l_prc->cblks.dec;
 1574|       |
 1575|   610k|        for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (1575:26): [True: 607k, False: 2.81k]
  ------------------
 1576|   607k|            opj_tcd_seg_t *l_seg = 00;
 1577|       |
 1578|   607k|            if (!l_cblk->numnewpasses) {
  ------------------
  |  Branch (1578:17): [True: 607k, False: 758]
  ------------------
 1579|       |                /* nothing to do */
 1580|   607k|                ++l_cblk;
 1581|   607k|                continue;
 1582|   607k|            }
 1583|       |
 1584|    758|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1584:17): [True: 255, False: 503]
  ------------------
 1585|    255|                l_seg = l_cblk->segs;
 1586|    255|                ++l_cblk->numsegs;
 1587|    503|            } else {
 1588|    503|                l_seg = &l_cblk->segs[l_cblk->numsegs - 1];
 1589|       |
 1590|    503|                if (l_seg->numpasses == l_seg->maxpasses) {
  ------------------
  |  Branch (1590:21): [True: 225, False: 278]
  ------------------
 1591|    225|                    ++l_seg;
 1592|    225|                    ++l_cblk->numsegs;
 1593|    225|                }
 1594|    503|            }
 1595|       |
 1596|  1.07k|            do {
 1597|       |                /* Check possible overflow then size */
 1598|  1.07k|                if (((*p_data_read + l_seg->newlen) < (*p_data_read)) ||
  ------------------
  |  Branch (1598:21): [True: 0, False: 1.07k]
  ------------------
 1599|  1.07k|                        ((*p_data_read + l_seg->newlen) > p_max_length)) {
  ------------------
  |  Branch (1599:25): [True: 36, False: 1.04k]
  ------------------
 1600|     36|                    if (p_t2->cp->strict) {
  ------------------
  |  Branch (1600:25): [True: 36, False: 0]
  ------------------
 1601|     36|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     36|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1602|     36|                                      "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1603|     36|                                      l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
 1604|     36|                                      p_pi->compno);
 1605|     36|                        return OPJ_FALSE;
  ------------------
  |  |  118|     36|#define OPJ_FALSE 0
  ------------------
 1606|     36|                    } else {
 1607|      0|                        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1608|      0|                                      "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1609|      0|                                      l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
 1610|      0|                                      p_pi->compno);
 1611|       |
 1612|      0|                        *p_data_read = p_max_length;
 1613|      0|                        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1614|      0|                    }
 1615|     36|                }
 1616|       |
 1617|       |#ifdef USE_JPWL
 1618|       |                /* we need here a j2k handle to verify if making a check to
 1619|       |                the validity of cblocks parameters is selected from user (-W) */
 1620|       |
 1621|       |                /* let's check that we are not exceeding */
 1622|       |                if ((l_cblk->len + l_seg->newlen) > 8192) {
 1623|       |                    opj_event_msg(p_manager, EVT_WARNING,
 1624|       |                                  "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1625|       |                                  l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
 1626|       |                    if (!JPWL_ASSUME) {
 1627|       |                        opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 1628|       |                        return -999;
 1629|       |                    }
 1630|       |                    l_seg->newlen = 8192 - l_cblk->len;
 1631|       |                    opj_event_msg(p_manager, EVT_WARNING, "      - truncating segment to %d\n",
 1632|       |                                  l_seg->newlen);
 1633|       |                    break;
 1634|       |                };
 1635|       |
 1636|       |#endif /* USE_JPWL */
 1637|  1.04k|                JAS_FPRINTF(stderr, "p_data_read (%d) newlen (%d) \n", *p_data_read,
  ------------------
  |  |  390|  1.04k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1638|  1.04k|                            l_seg->newlen);
 1639|  1.04k|                *(p_data_read) += l_seg->newlen;
 1640|       |
 1641|  1.04k|                l_seg->numpasses += l_seg->numnewpasses;
 1642|  1.04k|                l_cblk->numnewpasses -= l_seg->numnewpasses;
 1643|  1.04k|                if (l_cblk->numnewpasses > 0) {
  ------------------
  |  Branch (1643:21): [True: 319, False: 722]
  ------------------
 1644|    319|                    ++l_seg;
 1645|    319|                    ++l_cblk->numsegs;
 1646|    319|                }
 1647|  1.04k|            } while (l_cblk->numnewpasses > 0);
  ------------------
  |  Branch (1647:22): [True: 319, False: 722]
  ------------------
 1648|       |
 1649|    722|            ++l_cblk;
 1650|    722|        }
 1651|       |
 1652|  2.81k|        ++l_band;
 1653|  2.81k|    }
 1654|       |
 1655|  2.30k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.30k|#define OPJ_TRUE 1
  ------------------
 1656|  2.33k|}

opj_tcd_create:
  209|  7.47k|{
  210|  7.47k|    opj_tcd_t *l_tcd = 00;
  211|       |
  212|       |    /* create the tcd structure */
  213|  7.47k|    l_tcd = (opj_tcd_t*) opj_calloc(1, sizeof(opj_tcd_t));
  214|  7.47k|    if (!l_tcd) {
  ------------------
  |  Branch (214:9): [True: 0, False: 7.47k]
  ------------------
  215|      0|        return 00;
  216|      0|    }
  217|       |
  218|  7.47k|    l_tcd->m_is_decoder = p_is_decoder ? 1 : 0;
  ------------------
  |  Branch (218:27): [True: 7.47k, False: 0]
  ------------------
  219|       |
  220|  7.47k|    l_tcd->tcd_image = (opj_tcd_image_t*)opj_calloc(1, sizeof(opj_tcd_image_t));
  221|  7.47k|    if (!l_tcd->tcd_image) {
  ------------------
  |  Branch (221:9): [True: 0, False: 7.47k]
  ------------------
  222|      0|        opj_free(l_tcd);
  223|      0|        return 00;
  224|      0|    }
  225|       |
  226|  7.47k|    return l_tcd;
  227|  7.47k|}
opj_tcd_init:
  718|  7.47k|{
  719|  7.47k|    p_tcd->image = p_image;
  720|  7.47k|    p_tcd->cp = p_cp;
  721|       |
  722|  7.47k|    p_tcd->tcd_image->tiles = (opj_tcd_tile_t *) opj_calloc(1,
  723|  7.47k|                              sizeof(opj_tcd_tile_t));
  724|  7.47k|    if (! p_tcd->tcd_image->tiles) {
  ------------------
  |  Branch (724:9): [True: 0, False: 7.47k]
  ------------------
  725|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  726|      0|    }
  727|       |
  728|  7.47k|    p_tcd->tcd_image->tiles->comps = (opj_tcd_tilecomp_t *) opj_calloc(
  729|  7.47k|                                         p_image->numcomps, sizeof(opj_tcd_tilecomp_t));
  730|  7.47k|    if (! p_tcd->tcd_image->tiles->comps) {
  ------------------
  |  Branch (730:9): [True: 0, False: 7.47k]
  ------------------
  731|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  732|      0|    }
  733|       |
  734|  7.47k|    p_tcd->tcd_image->tiles->numcomps = p_image->numcomps;
  735|  7.47k|    p_tcd->tp_pos = p_cp->m_specific_param.m_enc.m_tp_pos;
  736|  7.47k|    p_tcd->thread_pool = p_tp;
  737|       |
  738|  7.47k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.47k|#define OPJ_TRUE 1
  ------------------
  739|  7.47k|}
opj_tcd_destroy:
  745|  8.85k|{
  746|  8.85k|    if (tcd) {
  ------------------
  |  Branch (746:9): [True: 7.47k, False: 1.37k]
  ------------------
  747|  7.47k|        opj_tcd_free_tile(tcd);
  748|       |
  749|  7.47k|        if (tcd->tcd_image) {
  ------------------
  |  Branch (749:13): [True: 7.47k, False: 0]
  ------------------
  750|  7.47k|            opj_free(tcd->tcd_image);
  751|  7.47k|            tcd->tcd_image = 00;
  752|  7.47k|        }
  753|       |
  754|  7.47k|        opj_free(tcd->used_component);
  755|       |
  756|  7.47k|        opj_free(tcd);
  757|  7.47k|    }
  758|  8.85k|}
opj_alloc_tile_component_data:
  761|  14.5k|{
  762|  14.5k|    if ((l_tilec->data == 00) ||
  ------------------
  |  Branch (762:9): [True: 13.3k, False: 1.16k]
  ------------------
  763|  14.5k|            ((l_tilec->data_size_needed > l_tilec->data_size) &&
  ------------------
  |  Branch (763:14): [True: 239, False: 922]
  ------------------
  764|  13.3k|             (l_tilec->ownsData == OPJ_FALSE))) {
  ------------------
  |  |  118|    239|#define OPJ_FALSE 0
  ------------------
  |  Branch (764:14): [True: 0, False: 239]
  ------------------
  765|  13.3k|        l_tilec->data = (OPJ_INT32 *) opj_image_data_alloc(l_tilec->data_size_needed);
  766|  13.3k|        if (!l_tilec->data && l_tilec->data_size_needed != 0) {
  ------------------
  |  Branch (766:13): [True: 3.31k, False: 10.0k]
  |  Branch (766:31): [True: 0, False: 3.31k]
  ------------------
  767|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  768|      0|        }
  769|       |        /*fprintf(stderr, "tAllocate data of tilec (int): %d x OPJ_UINT32n",l_data_size);*/
  770|  13.3k|        l_tilec->data_size = l_tilec->data_size_needed;
  771|  13.3k|        l_tilec->ownsData = OPJ_TRUE;
  ------------------
  |  |  117|  13.3k|#define OPJ_TRUE 1
  ------------------
  772|  13.3k|    } else if (l_tilec->data_size_needed > l_tilec->data_size) {
  ------------------
  |  Branch (772:16): [True: 239, False: 922]
  ------------------
  773|       |        /* We don't need to keep old data */
  774|    239|        opj_image_data_free(l_tilec->data);
  775|    239|        l_tilec->data = (OPJ_INT32 *) opj_image_data_alloc(l_tilec->data_size_needed);
  776|    239|        if (! l_tilec->data) {
  ------------------
  |  Branch (776:13): [True: 0, False: 239]
  ------------------
  777|      0|            l_tilec->data_size = 0;
  778|      0|            l_tilec->data_size_needed = 0;
  779|      0|            l_tilec->ownsData = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  780|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  781|      0|        }
  782|       |        /*fprintf(stderr, "tReallocate data of tilec (int): from %d to %d x OPJ_UINT32n", l_tilec->data_size, l_data_size);*/
  783|    239|        l_tilec->data_size = l_tilec->data_size_needed;
  784|    239|        l_tilec->ownsData = OPJ_TRUE;
  ------------------
  |  |  117|    239|#define OPJ_TRUE 1
  ------------------
  785|    239|    }
  786|  14.5k|    return OPJ_TRUE;
  ------------------
  |  |  117|  14.5k|#define OPJ_TRUE 1
  ------------------
  787|  14.5k|}
opj_tcd_init_decode_tile:
 1275|  7.39k|{
 1276|  7.39k|    return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_FALSE,
  ------------------
  |  |  118|  7.39k|#define OPJ_FALSE 0
  ------------------
 1277|  7.39k|                             sizeof(opj_tcd_cblk_dec_t), p_manager);
 1278|  7.39k|}
opj_tcd_reinit_segment:
 1349|   237M|{
 1350|   237M|    memset(seg, 0, sizeof(opj_tcd_seg_t));
 1351|   237M|}
opj_tcd_decode_tile:
 1558|  7.35k|{
 1559|  7.35k|    OPJ_UINT32 l_data_read;
 1560|  7.35k|    OPJ_UINT32 compno;
 1561|       |
 1562|  7.35k|    p_tcd->tcd_tileno = p_tile_no;
 1563|  7.35k|    p_tcd->tcp = &(p_tcd->cp->tcps[p_tile_no]);
 1564|  7.35k|    p_tcd->win_x0 = win_x0;
 1565|  7.35k|    p_tcd->win_y0 = win_y0;
 1566|  7.35k|    p_tcd->win_x1 = win_x1;
 1567|  7.35k|    p_tcd->win_y1 = win_y1;
 1568|  7.35k|    p_tcd->whole_tile_decoding = OPJ_TRUE;
  ------------------
  |  |  117|  7.35k|#define OPJ_TRUE 1
  ------------------
 1569|       |
 1570|  7.35k|    opj_free(p_tcd->used_component);
 1571|  7.35k|    p_tcd->used_component = NULL;
 1572|       |
 1573|  7.35k|    if (numcomps_to_decode) {
  ------------------
  |  Branch (1573:9): [True: 0, False: 7.35k]
  ------------------
 1574|      0|        OPJ_BOOL* used_component = (OPJ_BOOL*) opj_calloc(sizeof(OPJ_BOOL),
 1575|      0|                                   p_tcd->image->numcomps);
 1576|      0|        if (used_component == NULL) {
  ------------------
  |  Branch (1576:13): [True: 0, False: 0]
  ------------------
 1577|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1578|      0|        }
 1579|      0|        for (compno = 0; compno < numcomps_to_decode; compno++) {
  ------------------
  |  Branch (1579:26): [True: 0, False: 0]
  ------------------
 1580|      0|            used_component[ comps_indices[compno] ] = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1581|      0|        }
 1582|       |
 1583|      0|        p_tcd->used_component = used_component;
 1584|      0|    }
 1585|       |
 1586|  21.8k|    for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
  ------------------
  |  Branch (1586:22): [True: 17.7k, False: 4.17k]
  ------------------
 1587|  17.7k|        if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (1587:13): [True: 0, False: 17.7k]
  |  Branch (1587:46): [True: 0, False: 0]
  ------------------
 1588|      0|            continue;
 1589|      0|        }
 1590|       |
 1591|  17.7k|        if (!opj_tcd_is_whole_tilecomp_decoding(p_tcd, compno)) {
  ------------------
  |  Branch (1591:13): [True: 3.18k, False: 14.5k]
  ------------------
 1592|  3.18k|            p_tcd->whole_tile_decoding = OPJ_FALSE;
  ------------------
  |  |  118|  3.18k|#define OPJ_FALSE 0
  ------------------
 1593|  3.18k|            break;
 1594|  3.18k|        }
 1595|  17.7k|    }
 1596|       |
 1597|  7.35k|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (1597:9): [True: 4.17k, False: 3.18k]
  ------------------
 1598|  18.7k|        for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
  ------------------
  |  Branch (1598:26): [True: 14.5k, False: 4.17k]
  ------------------
 1599|  14.5k|            opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
 1600|  14.5k|            opj_tcd_resolution_t *l_res = &
 1601|  14.5k|                                          (tilec->resolutions[tilec->minimum_num_resolutions - 1]);
 1602|  14.5k|            OPJ_SIZE_T l_data_size;
 1603|       |
 1604|       |            /* compute l_data_size with overflow check */
 1605|  14.5k|            OPJ_SIZE_T res_w = (OPJ_SIZE_T)(l_res->x1 - l_res->x0);
 1606|  14.5k|            OPJ_SIZE_T res_h = (OPJ_SIZE_T)(l_res->y1 - l_res->y0);
 1607|       |
 1608|  14.5k|            if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (1608:17): [True: 0, False: 14.5k]
  |  Branch (1608:50): [True: 0, False: 0]
  ------------------
 1609|      0|                continue;
 1610|      0|            }
 1611|       |
 1612|       |            /* issue 733, l_data_size == 0U, probably something wrong should be checked before getting here */
 1613|  14.5k|            if (res_h > 0 && res_w > SIZE_MAX / res_h) {
  ------------------
  |  Branch (1613:17): [True: 12.0k, False: 2.44k]
  |  Branch (1613:30): [True: 0, False: 12.0k]
  ------------------
 1614|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1615|      0|                              "Size of tile data exceeds system limits\n");
 1616|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1617|      0|            }
 1618|  14.5k|            l_data_size = res_w * res_h;
 1619|       |
 1620|  14.5k|            if (SIZE_MAX / sizeof(OPJ_UINT32) < l_data_size) {
  ------------------
  |  Branch (1620:17): [True: 0, False: 14.5k]
  ------------------
 1621|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1622|      0|                              "Size of tile data exceeds system limits\n");
 1623|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1624|      0|            }
 1625|  14.5k|            l_data_size *= sizeof(OPJ_UINT32);
 1626|       |
 1627|  14.5k|            tilec->data_size_needed = l_data_size;
 1628|       |
 1629|  14.5k|            if (!opj_alloc_tile_component_data(tilec)) {
  ------------------
  |  Branch (1629:17): [True: 0, False: 14.5k]
  ------------------
 1630|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1631|      0|                              "Size of tile data exceeds system limits\n");
 1632|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1633|      0|            }
 1634|  14.5k|        }
 1635|  4.17k|    } else {
 1636|       |        /* Compute restricted tile-component and tile-resolution coordinates */
 1637|       |        /* of the window of interest, but defer the memory allocation until */
 1638|       |        /* we know the resno_decoded */
 1639|  12.4k|        for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
  ------------------
  |  Branch (1639:26): [True: 9.28k, False: 3.14k]
  ------------------
 1640|  9.28k|            OPJ_UINT32 resno;
 1641|  9.28k|            opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
 1642|  9.28k|            opj_image_comp_t* image_comp = &(p_tcd->image->comps[compno]);
 1643|       |
 1644|  9.28k|            if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (1644:17): [True: 0, False: 9.28k]
  |  Branch (1644:50): [True: 0, False: 0]
  ------------------
 1645|      0|                continue;
 1646|      0|            }
 1647|       |
 1648|       |            /* Compute the intersection of the area of interest, expressed in tile coordinates */
 1649|       |            /* with the tile coordinates */
 1650|  9.28k|            tilec->win_x0 = opj_uint_max(
 1651|  9.28k|                                (OPJ_UINT32)tilec->x0,
 1652|  9.28k|                                opj_uint_ceildiv(p_tcd->win_x0, image_comp->dx));
 1653|  9.28k|            tilec->win_y0 = opj_uint_max(
 1654|  9.28k|                                (OPJ_UINT32)tilec->y0,
 1655|  9.28k|                                opj_uint_ceildiv(p_tcd->win_y0, image_comp->dy));
 1656|  9.28k|            tilec->win_x1 = opj_uint_min(
 1657|  9.28k|                                (OPJ_UINT32)tilec->x1,
 1658|  9.28k|                                opj_uint_ceildiv(p_tcd->win_x1, image_comp->dx));
 1659|  9.28k|            tilec->win_y1 = opj_uint_min(
 1660|  9.28k|                                (OPJ_UINT32)tilec->y1,
 1661|  9.28k|                                opj_uint_ceildiv(p_tcd->win_y1, image_comp->dy));
 1662|  9.28k|            if (tilec->win_x1 < tilec->win_x0 ||
  ------------------
  |  Branch (1662:17): [True: 23, False: 9.26k]
  ------------------
 1663|  9.28k|                    tilec->win_y1 < tilec->win_y0) {
  ------------------
  |  Branch (1663:21): [True: 19, False: 9.24k]
  ------------------
 1664|       |                /* We should not normally go there. The circumstance is when */
 1665|       |                /* the tile coordinates do not intersect the area of interest */
 1666|       |                /* Upper level logic should not even try to decode that tile */
 1667|     42|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     42|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1668|     42|                              "Invalid tilec->win_xxx values\n");
 1669|     42|                return OPJ_FALSE;
  ------------------
  |  |  118|     42|#define OPJ_FALSE 0
  ------------------
 1670|     42|            }
 1671|       |
 1672|  69.5k|            for (resno = 0; resno < tilec->numresolutions; ++resno) {
  ------------------
  |  Branch (1672:29): [True: 60.2k, False: 9.24k]
  ------------------
 1673|  60.2k|                opj_tcd_resolution_t *res = tilec->resolutions + resno;
 1674|  60.2k|                res->win_x0 = opj_uint_ceildivpow2(tilec->win_x0,
 1675|  60.2k|                                                   tilec->numresolutions - 1 - resno);
 1676|  60.2k|                res->win_y0 = opj_uint_ceildivpow2(tilec->win_y0,
 1677|  60.2k|                                                   tilec->numresolutions - 1 - resno);
 1678|  60.2k|                res->win_x1 = opj_uint_ceildivpow2(tilec->win_x1,
 1679|  60.2k|                                                   tilec->numresolutions - 1 - resno);
 1680|  60.2k|                res->win_y1 = opj_uint_ceildivpow2(tilec->win_y1,
 1681|  60.2k|                                                   tilec->numresolutions - 1 - resno);
 1682|  60.2k|            }
 1683|  9.24k|        }
 1684|  3.18k|    }
 1685|       |
 1686|       |#ifdef TODO_MSD /* FIXME */
 1687|       |    /* INDEX >>  */
 1688|       |    if (p_cstr_info) {
 1689|       |        OPJ_UINT32 resno, compno, numprec = 0;
 1690|       |        for (compno = 0; compno < (OPJ_UINT32) p_cstr_info->numcomps; compno++) {
 1691|       |            opj_tcp_t *tcp = &p_tcd->cp->tcps[0];
 1692|       |            opj_tccp_t *tccp = &tcp->tccps[compno];
 1693|       |            opj_tcd_tilecomp_t *tilec_idx = &p_tcd->tcd_image->tiles->comps[compno];
 1694|       |            for (resno = 0; resno < tilec_idx->numresolutions; resno++) {
 1695|       |                opj_tcd_resolution_t *res_idx = &tilec_idx->resolutions[resno];
 1696|       |                p_cstr_info->tile[p_tile_no].pw[resno] = res_idx->pw;
 1697|       |                p_cstr_info->tile[p_tile_no].ph[resno] = res_idx->ph;
 1698|       |                numprec += res_idx->pw * res_idx->ph;
 1699|       |                p_cstr_info->tile[p_tile_no].pdx[resno] = tccp->prcw[resno];
 1700|       |                p_cstr_info->tile[p_tile_no].pdy[resno] = tccp->prch[resno];
 1701|       |            }
 1702|       |        }
 1703|       |        p_cstr_info->tile[p_tile_no].packet = (opj_packet_info_t *) opj_malloc(
 1704|       |                p_cstr_info->numlayers * numprec * sizeof(opj_packet_info_t));
 1705|       |        p_cstr_info->packno = 0;
 1706|       |    }
 1707|       |    /* << INDEX */
 1708|       |#endif
 1709|       |
 1710|       |    /*--------------TIER2------------------*/
 1711|       |    /* FIXME _ProfStart(PGROUP_T2); */
 1712|  7.31k|    l_data_read = 0;
 1713|  7.31k|    if (! opj_tcd_t2_decode(p_tcd, p_src, &l_data_read, p_max_length, p_cstr_index,
  ------------------
  |  Branch (1713:9): [True: 5.06k, False: 2.24k]
  ------------------
 1714|  7.31k|                            p_manager)) {
 1715|  5.06k|        return OPJ_FALSE;
  ------------------
  |  |  118|  5.06k|#define OPJ_FALSE 0
  ------------------
 1716|  5.06k|    }
 1717|       |    /* FIXME _ProfStop(PGROUP_T2); */
 1718|       |
 1719|       |    /*------------------TIER1-----------------*/
 1720|       |
 1721|       |    /* FIXME _ProfStart(PGROUP_T1); */
 1722|  2.24k|    if (! opj_tcd_t1_decode(p_tcd, p_manager)) {
  ------------------
  |  Branch (1722:9): [True: 83, False: 2.16k]
  ------------------
 1723|     83|        return OPJ_FALSE;
  ------------------
  |  |  118|     83|#define OPJ_FALSE 0
  ------------------
 1724|     83|    }
 1725|       |    /* FIXME _ProfStop(PGROUP_T1); */
 1726|       |
 1727|       |
 1728|       |    /* For subtile decoding, now we know the resno_decoded, we can allocate */
 1729|       |    /* the tile data buffer */
 1730|  2.16k|    if (!p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (1730:9): [True: 635, False: 1.53k]
  ------------------
 1731|  5.33k|        for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
  ------------------
  |  Branch (1731:26): [True: 4.69k, False: 635]
  ------------------
 1732|  4.69k|            opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
 1733|  4.69k|            opj_image_comp_t* image_comp = &(p_tcd->image->comps[compno]);
 1734|  4.69k|            opj_tcd_resolution_t *res = tilec->resolutions + image_comp->resno_decoded;
 1735|  4.69k|            OPJ_SIZE_T w = res->win_x1 - res->win_x0;
 1736|  4.69k|            OPJ_SIZE_T h = res->win_y1 - res->win_y0;
 1737|  4.69k|            OPJ_SIZE_T l_data_size;
 1738|       |
 1739|  4.69k|            opj_image_data_free(tilec->data_win);
 1740|  4.69k|            tilec->data_win = NULL;
 1741|       |
 1742|  4.69k|            if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (1742:17): [True: 0, False: 4.69k]
  |  Branch (1742:50): [True: 0, False: 0]
  ------------------
 1743|      0|                continue;
 1744|      0|            }
 1745|       |
 1746|  4.69k|            if (w > 0 && h > 0) {
  ------------------
  |  Branch (1746:17): [True: 4.09k, False: 599]
  |  Branch (1746:26): [True: 3.55k, False: 541]
  ------------------
 1747|  3.55k|                if (w > SIZE_MAX / h) {
  ------------------
  |  Branch (1747:21): [True: 0, False: 3.55k]
  ------------------
 1748|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1749|      0|                                  "Size of tile data exceeds system limits\n");
 1750|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1751|      0|                }
 1752|  3.55k|                l_data_size = w * h;
 1753|  3.55k|                if (l_data_size > SIZE_MAX / sizeof(OPJ_INT32)) {
  ------------------
  |  Branch (1753:21): [True: 0, False: 3.55k]
  ------------------
 1754|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1755|      0|                                  "Size of tile data exceeds system limits\n");
 1756|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1757|      0|                }
 1758|  3.55k|                l_data_size *= sizeof(OPJ_INT32);
 1759|       |
 1760|  3.55k|                tilec->data_win = (OPJ_INT32*) opj_image_data_alloc(l_data_size);
 1761|  3.55k|                if (tilec->data_win == NULL) {
  ------------------
  |  Branch (1761:21): [True: 0, False: 3.55k]
  ------------------
 1762|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1763|      0|                                  "Size of tile data exceeds system limits\n");
 1764|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1765|      0|                }
 1766|  3.55k|            }
 1767|  4.69k|        }
 1768|    635|    }
 1769|       |
 1770|       |    /*----------------DWT---------------------*/
 1771|       |
 1772|       |    /* FIXME _ProfStart(PGROUP_DWT); */
 1773|  2.16k|    if
 1774|  2.16k|    (! opj_tcd_dwt_decode(p_tcd)) {
  ------------------
  |  Branch (1774:6): [True: 0, False: 2.16k]
  ------------------
 1775|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1776|      0|    }
 1777|       |    /* FIXME _ProfStop(PGROUP_DWT); */
 1778|       |
 1779|       |    /*----------------MCT-------------------*/
 1780|       |    /* FIXME _ProfStart(PGROUP_MCT); */
 1781|  2.16k|    if
 1782|  2.16k|    (! opj_tcd_mct_decode(p_tcd, p_manager)) {
  ------------------
  |  Branch (1782:6): [True: 19, False: 2.14k]
  ------------------
 1783|     19|        return OPJ_FALSE;
  ------------------
  |  |  118|     19|#define OPJ_FALSE 0
  ------------------
 1784|     19|    }
 1785|       |    /* FIXME _ProfStop(PGROUP_MCT); */
 1786|       |
 1787|       |    /* FIXME _ProfStart(PGROUP_DC_SHIFT); */
 1788|  2.14k|    if
 1789|  2.14k|    (! opj_tcd_dc_level_shift_decode(p_tcd)) {
  ------------------
  |  Branch (1789:6): [True: 0, False: 2.14k]
  ------------------
 1790|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1791|      0|    }
 1792|       |    /* FIXME _ProfStop(PGROUP_DC_SHIFT); */
 1793|       |
 1794|       |
 1795|       |    /*---------------TILE-------------------*/
 1796|  2.14k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.14k|#define OPJ_TRUE 1
  ------------------
 1797|  2.14k|}
opj_tcd_is_band_empty:
 2779|   759k|{
 2780|   759k|    return (band->x1 - band->x0 == 0) || (band->y1 - band->y0 == 0);
  ------------------
  |  Branch (2780:12): [True: 74.9k, False: 684k]
  |  Branch (2780:42): [True: 42.4k, False: 642k]
  ------------------
 2781|   759k|}
opj_tcd_is_subband_area_of_interest:
 2791|  73.6M|{
 2792|       |    /* Note: those values for filter_margin are in part the result of */
 2793|       |    /* experimentation. The value 2 for QMFBID=1 (5x3 filter) can be linked */
 2794|       |    /* to the maximum left/right extension given in tables F.2 and F.3 of the */
 2795|       |    /* standard. The value 3 for QMFBID=0 (9x7 filter) is more suspicious, */
 2796|       |    /* since F.2 and F.3 would lead to 4 instead, so the current 3 might be */
 2797|       |    /* needed to be bumped to 4, in case inconsistencies are found while */
 2798|       |    /* decoding parts of irreversible coded images. */
 2799|       |    /* See opj_dwt_decode_partial_53 and opj_dwt_decode_partial_97 as well */
 2800|  73.6M|    OPJ_UINT32 filter_margin = (tcd->tcp->tccps[compno].qmfbid == 1) ? 2 : 3;
  ------------------
  |  Branch (2800:32): [True: 38.9M, False: 34.7M]
  ------------------
 2801|  73.6M|    opj_tcd_tilecomp_t *tilec = &(tcd->tcd_image->tiles->comps[compno]);
 2802|  73.6M|    opj_image_comp_t* image_comp = &(tcd->image->comps[compno]);
 2803|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 2804|       |    /* with the tile coordinates */
 2805|  73.6M|    OPJ_UINT32 tcx0 = opj_uint_max(
 2806|  73.6M|                          (OPJ_UINT32)tilec->x0,
 2807|  73.6M|                          opj_uint_ceildiv(tcd->win_x0, image_comp->dx));
 2808|  73.6M|    OPJ_UINT32 tcy0 = opj_uint_max(
 2809|  73.6M|                          (OPJ_UINT32)tilec->y0,
 2810|  73.6M|                          opj_uint_ceildiv(tcd->win_y0, image_comp->dy));
 2811|  73.6M|    OPJ_UINT32 tcx1 = opj_uint_min(
 2812|  73.6M|                          (OPJ_UINT32)tilec->x1,
 2813|  73.6M|                          opj_uint_ceildiv(tcd->win_x1, image_comp->dx));
 2814|  73.6M|    OPJ_UINT32 tcy1 = opj_uint_min(
 2815|  73.6M|                          (OPJ_UINT32)tilec->y1,
 2816|  73.6M|                          opj_uint_ceildiv(tcd->win_y1, image_comp->dy));
 2817|       |    /* Compute number of decomposition for this band. See table F-1 */
 2818|  73.6M|    OPJ_UINT32 nb = (resno == 0) ?
  ------------------
  |  Branch (2818:21): [True: 8.91M, False: 64.7M]
  ------------------
 2819|  8.91M|                    tilec->numresolutions - 1 :
 2820|  73.6M|                    tilec->numresolutions - resno;
 2821|       |    /* Map above tile-based coordinates to sub-band-based coordinates per */
 2822|       |    /* equation B-15 of the standard */
 2823|  73.6M|    OPJ_UINT32 x0b = bandno & 1;
 2824|  73.6M|    OPJ_UINT32 y0b = bandno >> 1;
 2825|  73.6M|    OPJ_UINT32 tbx0 = (nb == 0) ? tcx0 :
  ------------------
  |  Branch (2825:23): [True: 7.44M, False: 66.2M]
  ------------------
 2826|  73.6M|                      (tcx0 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2826:23): [True: 37.1M, False: 29.1M]
  ------------------
 2827|  66.2M|                      opj_uint_ceildivpow2(tcx0 - (1U << (nb - 1)) * x0b, nb);
 2828|  73.6M|    OPJ_UINT32 tby0 = (nb == 0) ? tcy0 :
  ------------------
  |  Branch (2828:23): [True: 7.44M, False: 66.2M]
  ------------------
 2829|  73.6M|                      (tcy0 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2829:23): [True: 13.8M, False: 52.3M]
  ------------------
 2830|  66.2M|                      opj_uint_ceildivpow2(tcy0 - (1U << (nb - 1)) * y0b, nb);
 2831|  73.6M|    OPJ_UINT32 tbx1 = (nb == 0) ? tcx1 :
  ------------------
  |  Branch (2831:23): [True: 7.44M, False: 66.2M]
  ------------------
 2832|  73.6M|                      (tcx1 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2832:23): [True: 3.32M, False: 62.9M]
  ------------------
 2833|  66.2M|                      opj_uint_ceildivpow2(tcx1 - (1U << (nb - 1)) * x0b, nb);
 2834|  73.6M|    OPJ_UINT32 tby1 = (nb == 0) ? tcy1 :
  ------------------
  |  Branch (2834:23): [True: 7.44M, False: 66.2M]
  ------------------
 2835|  73.6M|                      (tcy1 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2835:23): [True: 1.68M, False: 64.5M]
  ------------------
 2836|  66.2M|                      opj_uint_ceildivpow2(tcy1 - (1U << (nb - 1)) * y0b, nb);
 2837|  73.6M|    OPJ_BOOL intersects;
 2838|       |
 2839|  73.6M|    if (tbx0 < filter_margin) {
  ------------------
  |  Branch (2839:9): [True: 46.1M, False: 27.5M]
  ------------------
 2840|  46.1M|        tbx0 = 0;
 2841|  46.1M|    } else {
 2842|  27.5M|        tbx0 -= filter_margin;
 2843|  27.5M|    }
 2844|  73.6M|    if (tby0 < filter_margin) {
  ------------------
  |  Branch (2844:9): [True: 28.7M, False: 44.9M]
  ------------------
 2845|  28.7M|        tby0 = 0;
 2846|  44.9M|    } else {
 2847|  44.9M|        tby0 -= filter_margin;
 2848|  44.9M|    }
 2849|  73.6M|    tbx1 = opj_uint_adds(tbx1, filter_margin);
 2850|  73.6M|    tby1 = opj_uint_adds(tby1, filter_margin);
 2851|       |
 2852|  73.6M|    intersects = band_x0 < tbx1 && band_y0 < tby1 && band_x1 > tbx0 &&
  ------------------
  |  Branch (2852:18): [True: 42.0M, False: 31.6M]
  |  Branch (2852:36): [True: 20.3M, False: 21.6M]
  |  Branch (2852:54): [True: 19.3M, False: 1.03M]
  ------------------
 2853|  73.6M|                 band_y1 > tby0;
  ------------------
  |  Branch (2853:18): [True: 19.2M, False: 34.2k]
  ------------------
 2854|       |
 2855|       |#ifdef DEBUG_VERBOSE
 2856|       |    printf("compno=%u resno=%u nb=%u bandno=%u x0b=%u y0b=%u band=%u,%u,%u,%u tb=%u,%u,%u,%u -> %u\n",
 2857|       |           compno, resno, nb, bandno, x0b, y0b,
 2858|       |           band_x0, band_y0, band_x1, band_y1,
 2859|       |           tbx0, tby0, tbx1, tby1, intersects);
 2860|       |#endif
 2861|  73.6M|    return intersects;
 2862|  73.6M|}
tcd.c:opj_tcd_init_tile:
  794|  7.39k|{
  795|  7.39k|    OPJ_UINT32 compno, resno, bandno, precno, cblkno;
  796|  7.39k|    opj_tcp_t * l_tcp = 00;
  797|  7.39k|    opj_cp_t * l_cp = 00;
  798|  7.39k|    opj_tcd_tile_t * l_tile = 00;
  799|  7.39k|    opj_tccp_t *l_tccp = 00;
  800|  7.39k|    opj_tcd_tilecomp_t *l_tilec = 00;
  801|  7.39k|    opj_image_comp_t * l_image_comp = 00;
  802|  7.39k|    opj_tcd_resolution_t *l_res = 00;
  803|  7.39k|    opj_tcd_band_t *l_band = 00;
  804|  7.39k|    opj_stepsize_t * l_step_size = 00;
  805|  7.39k|    opj_tcd_precinct_t *l_current_precinct = 00;
  806|  7.39k|    opj_image_t *l_image = 00;
  807|  7.39k|    OPJ_UINT32 p, q;
  808|  7.39k|    OPJ_UINT32 l_level_no;
  809|  7.39k|    OPJ_UINT32 l_pdx, l_pdy;
  810|  7.39k|    OPJ_INT32 l_x0b, l_y0b;
  811|  7.39k|    OPJ_UINT32 l_tx0, l_ty0;
  812|       |    /* extent of precincts , top left, bottom right**/
  813|  7.39k|    OPJ_INT32 l_tl_prc_x_start, l_tl_prc_y_start, l_br_prc_x_end, l_br_prc_y_end;
  814|       |    /* number of precinct for a resolution */
  815|  7.39k|    OPJ_UINT32 l_nb_precincts;
  816|       |    /* room needed to store l_nb_precinct precinct for a resolution */
  817|  7.39k|    OPJ_UINT32 l_nb_precinct_size;
  818|       |    /* number of code blocks for a precinct*/
  819|  7.39k|    OPJ_UINT32 l_nb_code_blocks;
  820|       |    /* room needed to store l_nb_code_blocks code blocks for a precinct*/
  821|  7.39k|    OPJ_UINT32 l_nb_code_blocks_size;
  822|       |    /* size of data for a tile */
  823|  7.39k|    OPJ_UINT32 l_data_size;
  824|       |
  825|  7.39k|    l_cp = p_tcd->cp;
  826|  7.39k|    l_tcp = &(l_cp->tcps[p_tile_no]);
  827|  7.39k|    l_tile = p_tcd->tcd_image->tiles;
  828|  7.39k|    l_tccp = l_tcp->tccps;
  829|  7.39k|    l_tilec = l_tile->comps;
  830|  7.39k|    l_image = p_tcd->image;
  831|  7.39k|    l_image_comp = p_tcd->image->comps;
  832|       |
  833|  7.39k|    p = p_tile_no % l_cp->tw;       /* tile coordinates */
  834|  7.39k|    q = p_tile_no / l_cp->tw;
  835|       |    /*fprintf(stderr, "Tile coordinate = %d,%d\n", p, q);*/
  836|       |
  837|       |    /* 4 borders of the tile rescale on the image if necessary */
  838|  7.39k|    l_tx0 = l_cp->tx0 + p *
  839|  7.39k|            l_cp->tdx; /* can't be greater than l_image->x1 so won't overflow */
  840|  7.39k|    l_tile->x0 = (OPJ_INT32)opj_uint_max(l_tx0, l_image->x0);
  841|  7.39k|    l_tile->x1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_tx0, l_cp->tdx),
  842|  7.39k|                                         l_image->x1);
  843|       |    /* all those OPJ_UINT32 are casted to OPJ_INT32, let's do some sanity check */
  844|  7.39k|    if ((l_tile->x0 < 0) || (l_tile->x1 <= l_tile->x0)) {
  ------------------
  |  Branch (844:9): [True: 1, False: 7.39k]
  |  Branch (844:29): [True: 16, False: 7.38k]
  ------------------
  845|     17|        opj_event_msg(manager, EVT_ERROR, "Tile X coordinates are not supported\n");
  ------------------
  |  |   66|     17|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  846|     17|        return OPJ_FALSE;
  ------------------
  |  |  118|     17|#define OPJ_FALSE 0
  ------------------
  847|     17|    }
  848|  7.38k|    l_ty0 = l_cp->ty0 + q *
  849|  7.38k|            l_cp->tdy; /* can't be greater than l_image->y1 so won't overflow */
  850|  7.38k|    l_tile->y0 = (OPJ_INT32)opj_uint_max(l_ty0, l_image->y0);
  851|  7.38k|    l_tile->y1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_ty0, l_cp->tdy),
  852|  7.38k|                                         l_image->y1);
  853|       |    /* all those OPJ_UINT32 are casted to OPJ_INT32, let's do some sanity check */
  854|  7.38k|    if ((l_tile->y0 < 0) || (l_tile->y1 <= l_tile->y0)) {
  ------------------
  |  Branch (854:9): [True: 1, False: 7.38k]
  |  Branch (854:29): [True: 7, False: 7.37k]
  ------------------
  855|      8|        opj_event_msg(manager, EVT_ERROR, "Tile Y coordinates are not supported\n");
  ------------------
  |  |   66|      8|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  856|      8|        return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
  857|      8|    }
  858|       |
  859|       |
  860|       |    /* testcase 1888.pdf.asan.35.988 */
  861|  7.37k|    if (l_tccp->numresolutions == 0) {
  ------------------
  |  Branch (861:9): [True: 0, False: 7.37k]
  ------------------
  862|      0|        opj_event_msg(manager, EVT_ERROR, "tiles require at least one resolution\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  863|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  864|      0|    }
  865|       |    /*fprintf(stderr, "Tile border = %d,%d,%d,%d\n", l_tile->x0, l_tile->y0,l_tile->x1,l_tile->y1);*/
  866|       |
  867|       |    /*tile->numcomps = image->numcomps; */
  868|  31.2k|    for (compno = 0; compno < l_tile->numcomps; ++compno) {
  ------------------
  |  Branch (868:22): [True: 23.8k, False: 7.36k]
  ------------------
  869|       |        /*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps);*/
  870|  23.8k|        l_image_comp->resno_decoded = 0;
  871|       |        /* border of each l_tile component (global) */
  872|  23.8k|        l_tilec->x0 = opj_int_ceildiv(l_tile->x0, (OPJ_INT32)l_image_comp->dx);
  873|  23.8k|        l_tilec->y0 = opj_int_ceildiv(l_tile->y0, (OPJ_INT32)l_image_comp->dy);
  874|  23.8k|        l_tilec->x1 = opj_int_ceildiv(l_tile->x1, (OPJ_INT32)l_image_comp->dx);
  875|  23.8k|        l_tilec->y1 = opj_int_ceildiv(l_tile->y1, (OPJ_INT32)l_image_comp->dy);
  876|  23.8k|        l_tilec->compno = compno;
  877|       |        /*fprintf(stderr, "\tTile compo border = %d,%d,%d,%d\n", l_tilec->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/
  878|       |
  879|  23.8k|        l_tilec->numresolutions = l_tccp->numresolutions;
  880|  23.8k|        if (l_tccp->numresolutions < l_cp->m_specific_param.m_dec.m_reduce) {
  ------------------
  |  Branch (880:13): [True: 0, False: 23.8k]
  ------------------
  881|      0|            l_tilec->minimum_num_resolutions = 1;
  882|  23.8k|        } else {
  883|  23.8k|            l_tilec->minimum_num_resolutions = l_tccp->numresolutions -
  884|  23.8k|                                               l_cp->m_specific_param.m_dec.m_reduce;
  885|  23.8k|        }
  886|       |
  887|  23.8k|        if (isEncoder) {
  ------------------
  |  Branch (887:13): [True: 0, False: 23.8k]
  ------------------
  888|      0|            OPJ_SIZE_T l_tile_data_size;
  889|       |
  890|       |            /* compute l_data_size with overflow check */
  891|      0|            OPJ_SIZE_T w = (OPJ_SIZE_T)(l_tilec->x1 - l_tilec->x0);
  892|      0|            OPJ_SIZE_T h = (OPJ_SIZE_T)(l_tilec->y1 - l_tilec->y0);
  893|       |
  894|       |            /* issue 733, l_data_size == 0U, probably something wrong should be checked before getting here */
  895|      0|            if (h > 0 && w > SIZE_MAX / h) {
  ------------------
  |  Branch (895:17): [True: 0, False: 0]
  |  Branch (895:26): [True: 0, False: 0]
  ------------------
  896|      0|                opj_event_msg(manager, EVT_ERROR, "Size of tile data exceeds system limits\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  897|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  898|      0|            }
  899|      0|            l_tile_data_size = w * h;
  900|       |
  901|      0|            if (SIZE_MAX / sizeof(OPJ_UINT32) < l_tile_data_size) {
  ------------------
  |  Branch (901:17): [True: 0, False: 0]
  ------------------
  902|      0|                opj_event_msg(manager, EVT_ERROR, "Size of tile data exceeds system limits\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  903|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  904|      0|            }
  905|      0|            l_tile_data_size = l_tile_data_size * sizeof(OPJ_UINT32);
  906|       |
  907|      0|            l_tilec->data_size_needed = l_tile_data_size;
  908|      0|        }
  909|       |
  910|  23.8k|        l_data_size = l_tilec->numresolutions * (OPJ_UINT32)sizeof(
  911|  23.8k|                          opj_tcd_resolution_t);
  912|       |
  913|  23.8k|        opj_image_data_free(l_tilec->data_win);
  914|  23.8k|        l_tilec->data_win = NULL;
  915|  23.8k|        l_tilec->win_x0 = 0;
  916|  23.8k|        l_tilec->win_y0 = 0;
  917|  23.8k|        l_tilec->win_x1 = 0;
  918|  23.8k|        l_tilec->win_y1 = 0;
  919|       |
  920|  23.8k|        if (l_tilec->resolutions == 00) {
  ------------------
  |  Branch (920:13): [True: 21.6k, False: 2.24k]
  ------------------
  921|  21.6k|            l_tilec->resolutions = (opj_tcd_resolution_t *) opj_malloc(l_data_size);
  922|  21.6k|            if (! l_tilec->resolutions) {
  ------------------
  |  Branch (922:17): [True: 0, False: 21.6k]
  ------------------
  923|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  924|      0|            }
  925|       |            /*fprintf(stderr, "\tAllocate resolutions of tilec (opj_tcd_resolution_t): %d\n",l_data_size);*/
  926|  21.6k|            l_tilec->resolutions_size = l_data_size;
  927|  21.6k|            memset(l_tilec->resolutions, 0, l_data_size);
  928|  21.6k|        } else if (l_data_size > l_tilec->resolutions_size) {
  ------------------
  |  Branch (928:20): [True: 0, False: 2.24k]
  ------------------
  929|      0|            opj_tcd_resolution_t* new_resolutions = (opj_tcd_resolution_t *) opj_realloc(
  930|      0|                    l_tilec->resolutions, l_data_size);
  931|      0|            if (! new_resolutions) {
  ------------------
  |  Branch (931:17): [True: 0, False: 0]
  ------------------
  932|      0|                opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile resolutions\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  933|      0|                opj_free(l_tilec->resolutions);
  934|      0|                l_tilec->resolutions = NULL;
  935|      0|                l_tilec->resolutions_size = 0;
  936|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  937|      0|            }
  938|      0|            l_tilec->resolutions = new_resolutions;
  939|       |            /*fprintf(stderr, "\tReallocate data of tilec (int): from %d to %d x OPJ_UINT32\n", l_tilec->resolutions_size, l_data_size);*/
  940|      0|            memset(((OPJ_BYTE*) l_tilec->resolutions) + l_tilec->resolutions_size, 0,
  941|      0|                   l_data_size - l_tilec->resolutions_size);
  942|      0|            l_tilec->resolutions_size = l_data_size;
  943|      0|        }
  944|       |
  945|  23.8k|        l_level_no = l_tilec->numresolutions;
  946|  23.8k|        l_res = l_tilec->resolutions;
  947|  23.8k|        l_step_size = l_tccp->stepsizes;
  948|       |        /*fprintf(stderr, "\tlevel_no=%d\n",l_level_no);*/
  949|       |
  950|   228k|        for (resno = 0; resno < l_tilec->numresolutions; ++resno) {
  ------------------
  |  Branch (950:25): [True: 204k, False: 23.8k]
  ------------------
  951|       |            /*fprintf(stderr, "\t\tresno = %d/%d\n", resno, l_tilec->numresolutions);*/
  952|   204k|            OPJ_INT32 tlcbgxstart, tlcbgystart /*, brcbgxend, brcbgyend*/;
  953|   204k|            OPJ_UINT32 cbgwidthexpn, cbgheightexpn;
  954|   204k|            OPJ_UINT32 cblkwidthexpn, cblkheightexpn;
  955|       |
  956|   204k|            --l_level_no;
  957|       |
  958|       |            /* border for each resolution level (global) */
  959|   204k|            l_res->x0 = opj_int_ceildivpow2(l_tilec->x0, (OPJ_INT32)l_level_no);
  960|   204k|            l_res->y0 = opj_int_ceildivpow2(l_tilec->y0, (OPJ_INT32)l_level_no);
  961|   204k|            l_res->x1 = opj_int_ceildivpow2(l_tilec->x1, (OPJ_INT32)l_level_no);
  962|   204k|            l_res->y1 = opj_int_ceildivpow2(l_tilec->y1, (OPJ_INT32)l_level_no);
  963|       |
  964|       |            /*fprintf(stderr, "\t\t\tres_x0= %d, res_y0 =%d, res_x1=%d, res_y1=%d\n", l_res->x0, l_res->y0, l_res->x1, l_res->y1);*/
  965|       |            /* p. 35, table A-23, ISO/IEC FDIS154444-1 : 2000 (18 august 2000) */
  966|   204k|            l_pdx = l_tccp->prcw[resno];
  967|   204k|            l_pdy = l_tccp->prch[resno];
  968|       |            /*fprintf(stderr, "\t\t\tpdx=%d, pdy=%d\n", l_pdx, l_pdy);*/
  969|       |            /* p. 64, B.6, ISO/IEC FDIS15444-1 : 2000 (18 august 2000)  */
  970|   204k|            l_tl_prc_x_start = opj_int_floordivpow2(l_res->x0, (OPJ_INT32)l_pdx) << l_pdx;
  971|   204k|            l_tl_prc_y_start = opj_int_floordivpow2(l_res->y0, (OPJ_INT32)l_pdy) << l_pdy;
  972|   204k|            {
  973|   204k|                OPJ_UINT32 tmp = ((OPJ_UINT32)opj_int_ceildivpow2(l_res->x1,
  974|   204k|                                  (OPJ_INT32)l_pdx)) << l_pdx;
  975|   204k|                if (tmp > (OPJ_UINT32)INT_MAX) {
  ------------------
  |  Branch (975:21): [True: 1, False: 204k]
  ------------------
  976|      1|                    opj_event_msg(manager, EVT_ERROR, "Integer overflow\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  977|      1|                    return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
  978|      1|                }
  979|   204k|                l_br_prc_x_end = (OPJ_INT32)tmp;
  980|   204k|            }
  981|      0|            {
  982|   204k|                OPJ_UINT32 tmp = ((OPJ_UINT32)opj_int_ceildivpow2(l_res->y1,
  983|   204k|                                  (OPJ_INT32)l_pdy)) << l_pdy;
  984|   204k|                if (tmp > (OPJ_UINT32)INT_MAX) {
  ------------------
  |  Branch (984:21): [True: 0, False: 204k]
  ------------------
  985|      0|                    opj_event_msg(manager, EVT_ERROR, "Integer overflow\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  986|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  987|      0|                }
  988|   204k|                l_br_prc_y_end = (OPJ_INT32)tmp;
  989|   204k|            }
  990|       |            /*fprintf(stderr, "\t\t\tprc_x_start=%d, prc_y_start=%d, br_prc_x_end=%d, br_prc_y_end=%d \n", l_tl_prc_x_start, l_tl_prc_y_start, l_br_prc_x_end ,l_br_prc_y_end );*/
  991|       |
  992|   204k|            l_res->pw = (l_res->x0 == l_res->x1) ? 0U : (OPJ_UINT32)((
  ------------------
  |  Branch (992:25): [True: 120k, False: 84.0k]
  ------------------
  993|  84.0k|                            l_br_prc_x_end - l_tl_prc_x_start) >> l_pdx);
  994|   204k|            l_res->ph = (l_res->y0 == l_res->y1) ? 0U : (OPJ_UINT32)((
  ------------------
  |  Branch (994:25): [True: 104k, False: 100k]
  ------------------
  995|   100k|                            l_br_prc_y_end - l_tl_prc_y_start) >> l_pdy);
  996|       |            /*fprintf(stderr, "\t\t\tres_pw=%d, res_ph=%d\n", l_res->pw, l_res->ph );*/
  997|       |
  998|   204k|            if ((l_res->pw != 0U) && ((((OPJ_UINT32) - 1) / l_res->pw) < l_res->ph)) {
  ------------------
  |  Branch (998:17): [True: 84.0k, False: 120k]
  |  Branch (998:38): [True: 4, False: 84.0k]
  ------------------
  999|      4|                opj_event_msg(manager, EVT_ERROR, "Size of tile data exceeds system limits\n");
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1000|      4|                return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 1001|      4|            }
 1002|   204k|            l_nb_precincts = l_res->pw * l_res->ph;
 1003|       |
 1004|   204k|            if ((((OPJ_UINT32) - 1) / (OPJ_UINT32)sizeof(opj_tcd_precinct_t)) <
  ------------------
  |  Branch (1004:17): [True: 5, False: 204k]
  ------------------
 1005|   204k|                    l_nb_precincts) {
 1006|      5|                opj_event_msg(manager, EVT_ERROR, "Size of tile data exceeds system limits\n");
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1007|      5|                return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 1008|      5|            }
 1009|   204k|            l_nb_precinct_size = l_nb_precincts * (OPJ_UINT32)sizeof(opj_tcd_precinct_t);
 1010|       |
 1011|   204k|            if (resno == 0) {
  ------------------
  |  Branch (1011:17): [True: 23.8k, False: 180k]
  ------------------
 1012|  23.8k|                tlcbgxstart = l_tl_prc_x_start;
 1013|  23.8k|                tlcbgystart = l_tl_prc_y_start;
 1014|       |                /*brcbgxend = l_br_prc_x_end;*/
 1015|       |                /* brcbgyend = l_br_prc_y_end;*/
 1016|  23.8k|                cbgwidthexpn = l_pdx;
 1017|  23.8k|                cbgheightexpn = l_pdy;
 1018|  23.8k|                l_res->numbands = 1;
 1019|   180k|            } else {
 1020|   180k|                tlcbgxstart = opj_int_ceildivpow2(l_tl_prc_x_start, 1);
 1021|   180k|                tlcbgystart = opj_int_ceildivpow2(l_tl_prc_y_start, 1);
 1022|       |                /*brcbgxend = opj_int_ceildivpow2(l_br_prc_x_end, 1);*/
 1023|       |                /*brcbgyend = opj_int_ceildivpow2(l_br_prc_y_end, 1);*/
 1024|   180k|                cbgwidthexpn = l_pdx - 1;
 1025|   180k|                cbgheightexpn = l_pdy - 1;
 1026|   180k|                l_res->numbands = 3;
 1027|   180k|            }
 1028|       |
 1029|   204k|            cblkwidthexpn = opj_uint_min(l_tccp->cblkw, cbgwidthexpn);
 1030|   204k|            cblkheightexpn = opj_uint_min(l_tccp->cblkh, cbgheightexpn);
 1031|   204k|            l_band = l_res->bands;
 1032|       |
 1033|   770k|            for (bandno = 0; bandno < l_res->numbands; ++bandno, ++l_band, ++l_step_size) {
  ------------------
  |  Branch (1033:30): [True: 566k, False: 204k]
  ------------------
 1034|       |                /*fprintf(stderr, "\t\t\tband_no=%d/%d\n", bandno, l_res->numbands );*/
 1035|       |
 1036|   566k|                if (resno == 0) {
  ------------------
  |  Branch (1036:21): [True: 23.8k, False: 542k]
  ------------------
 1037|  23.8k|                    l_band->bandno = 0 ;
 1038|  23.8k|                    l_band->x0 = opj_int_ceildivpow2(l_tilec->x0, (OPJ_INT32)l_level_no);
 1039|  23.8k|                    l_band->y0 = opj_int_ceildivpow2(l_tilec->y0, (OPJ_INT32)l_level_no);
 1040|  23.8k|                    l_band->x1 = opj_int_ceildivpow2(l_tilec->x1, (OPJ_INT32)l_level_no);
 1041|  23.8k|                    l_band->y1 = opj_int_ceildivpow2(l_tilec->y1, (OPJ_INT32)l_level_no);
 1042|   542k|                } else {
 1043|   542k|                    l_band->bandno = bandno + 1;
 1044|       |                    /* x0b = 1 if bandno = 1 or 3 */
 1045|   542k|                    l_x0b = l_band->bandno & 1;
 1046|       |                    /* y0b = 1 if bandno = 2 or 3 */
 1047|   542k|                    l_y0b = (OPJ_INT32)((l_band->bandno) >> 1);
 1048|       |                    /* l_band border (global) */
 1049|   542k|                    l_band->x0 = opj_int64_ceildivpow2(l_tilec->x0 - ((OPJ_INT64)l_x0b <<
 1050|   542k|                                                       l_level_no), (OPJ_INT32)(l_level_no + 1));
 1051|   542k|                    l_band->y0 = opj_int64_ceildivpow2(l_tilec->y0 - ((OPJ_INT64)l_y0b <<
 1052|   542k|                                                       l_level_no), (OPJ_INT32)(l_level_no + 1));
 1053|   542k|                    l_band->x1 = opj_int64_ceildivpow2(l_tilec->x1 - ((OPJ_INT64)l_x0b <<
 1054|   542k|                                                       l_level_no), (OPJ_INT32)(l_level_no + 1));
 1055|   542k|                    l_band->y1 = opj_int64_ceildivpow2(l_tilec->y1 - ((OPJ_INT64)l_y0b <<
 1056|   542k|                                                       l_level_no), (OPJ_INT32)(l_level_no + 1));
 1057|   542k|                }
 1058|       |
 1059|   566k|                if (isEncoder) {
  ------------------
  |  Branch (1059:21): [True: 0, False: 566k]
  ------------------
 1060|       |                    /* Skip empty bands */
 1061|      0|                    if (opj_tcd_is_band_empty(l_band)) {
  ------------------
  |  Branch (1061:25): [True: 0, False: 0]
  ------------------
 1062|       |                        /* Do not zero l_band->precints to avoid leaks */
 1063|       |                        /* but make sure we don't use it later, since */
 1064|       |                        /* it will point to precincts of previous bands... */
 1065|      0|                        continue;
 1066|      0|                    }
 1067|      0|                }
 1068|       |
 1069|   566k|                {
 1070|       |                    /* Table E-1 - Sub-band gains */
 1071|       |                    /* BUG_WEIRD_TWO_INVK (look for this identifier in dwt.c): */
 1072|       |                    /* the test (!isEncoder && l_tccp->qmfbid == 0) is strongly */
 1073|       |                    /* linked to the use of two_invK instead of invK */
 1074|   566k|                    const OPJ_INT32 log2_gain = (!isEncoder &&
  ------------------
  |  Branch (1074:50): [True: 566k, False: 0]
  ------------------
 1075|   566k|                                                 l_tccp->qmfbid == 0) ? 0 : (l_band->bandno == 0) ? 0 :
  ------------------
  |  Branch (1075:50): [True: 150k, False: 415k]
  |  Branch (1075:77): [True: 16.1k, False: 398k]
  ------------------
 1076|   415k|                                                (l_band->bandno == 3) ? 2 : 1;
  ------------------
  |  Branch (1076:49): [True: 132k, False: 265k]
  ------------------
 1077|       |
 1078|       |                    /* Nominal dynamic range. Equation E-4 */
 1079|   566k|                    const OPJ_INT32 Rb = (OPJ_INT32)l_image_comp->prec + log2_gain;
 1080|       |
 1081|       |                    /* Delta_b value of Equation E-3 in "E.1 Inverse quantization
 1082|       |                    * procedure" of the standard */
 1083|   566k|                    l_band->stepsize = (OPJ_FLOAT32)(((1.0 + l_step_size->mant / 2048.0) * pow(2.0,
 1084|   566k|                                                      (OPJ_INT32)(Rb - l_step_size->expn))));
 1085|   566k|                }
 1086|       |
 1087|       |                /* Mb value of Equation E-2 in "E.1 Inverse quantization
 1088|       |                 * procedure" of the standard */
 1089|   566k|                l_band->numbps = l_step_size->expn + (OPJ_INT32)l_tccp->numgbits -
 1090|   566k|                                 1;
 1091|       |
 1092|   566k|                if (!l_band->precincts && (l_nb_precincts > 0U)) {
  ------------------
  |  Branch (1092:21): [True: 536k, False: 29.1k]
  |  Branch (1092:43): [True: 161k, False: 375k]
  ------------------
 1093|   161k|                    l_band->precincts = (opj_tcd_precinct_t *) opj_malloc(/*3 * */
 1094|   161k|                                            l_nb_precinct_size);
 1095|   161k|                    if (! l_band->precincts) {
  ------------------
  |  Branch (1095:25): [True: 0, False: 161k]
  ------------------
 1096|      0|                        opj_event_msg(manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1097|      0|                                      "Not enough memory to handle band precints\n");
 1098|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1099|      0|                    }
 1100|       |                    /*fprintf(stderr, "\t\t\t\tAllocate precincts of a band (opj_tcd_precinct_t): %d\n",l_nb_precinct_size);     */
 1101|   161k|                    memset(l_band->precincts, 0, l_nb_precinct_size);
 1102|   161k|                    l_band->precincts_data_size = l_nb_precinct_size;
 1103|   404k|                } else if (l_band->precincts_data_size < l_nb_precinct_size) {
  ------------------
  |  Branch (1103:28): [True: 143, False: 404k]
  ------------------
 1104|       |
 1105|    143|                    opj_tcd_precinct_t * new_precincts = (opj_tcd_precinct_t *) opj_realloc(
 1106|    143|                            l_band->precincts,/*3 * */ l_nb_precinct_size);
 1107|    143|                    if (! new_precincts) {
  ------------------
  |  Branch (1107:25): [True: 0, False: 143]
  ------------------
 1108|      0|                        opj_event_msg(manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1109|      0|                                      "Not enough memory to handle band precints\n");
 1110|      0|                        opj_free(l_band->precincts);
 1111|      0|                        l_band->precincts = NULL;
 1112|      0|                        l_band->precincts_data_size = 0;
 1113|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1114|      0|                    }
 1115|    143|                    l_band->precincts = new_precincts;
 1116|       |                    /*fprintf(stderr, "\t\t\t\tReallocate precincts of a band (opj_tcd_precinct_t): from %d to %d\n",l_band->precincts_data_size, l_nb_precinct_size);*/
 1117|    143|                    memset(((OPJ_BYTE *) l_band->precincts) + l_band->precincts_data_size, 0,
 1118|    143|                           l_nb_precinct_size - l_band->precincts_data_size);
 1119|    143|                    l_band->precincts_data_size = l_nb_precinct_size;
 1120|    143|                }
 1121|       |
 1122|   566k|                l_current_precinct = l_band->precincts;
 1123|  31.0M|                for (precno = 0; precno < l_nb_precincts; ++precno) {
  ------------------
  |  Branch (1123:34): [True: 30.5M, False: 566k]
  ------------------
 1124|  30.5M|                    OPJ_INT32 tlcblkxstart, tlcblkystart, brcblkxend, brcblkyend;
 1125|  30.5M|                    OPJ_INT32 cbgxstart = tlcbgxstart + (OPJ_INT32)(precno % l_res->pw) *
 1126|  30.5M|                                          (1 << cbgwidthexpn);
 1127|  30.5M|                    OPJ_INT32 cbgystart = tlcbgystart + (OPJ_INT32)(precno / l_res->pw) *
 1128|  30.5M|                                          (1 << cbgheightexpn);
 1129|  30.5M|                    OPJ_INT32 cbgxend = cbgxstart + (1 << cbgwidthexpn);
 1130|  30.5M|                    OPJ_INT32 cbgyend = cbgystart + (1 << cbgheightexpn);
 1131|       |                    /*fprintf(stderr, "\t precno=%d; bandno=%d, resno=%d; compno=%d\n", precno, bandno , resno, compno);*/
 1132|       |                    /*fprintf(stderr, "\t tlcbgxstart(=%d) + (precno(=%d) percent res->pw(=%d)) * (1 << cbgwidthexpn(=%d)) \n",tlcbgxstart,precno,l_res->pw,cbgwidthexpn);*/
 1133|       |
 1134|       |                    /* precinct size (global) */
 1135|       |                    /*fprintf(stderr, "\t cbgxstart=%d, l_band->x0 = %d \n",cbgxstart, l_band->x0);*/
 1136|       |
 1137|  30.5M|                    l_current_precinct->x0 = opj_int_max(cbgxstart, l_band->x0);
 1138|  30.5M|                    l_current_precinct->y0 = opj_int_max(cbgystart, l_band->y0);
 1139|  30.5M|                    l_current_precinct->x1 = opj_int_min(cbgxend, l_band->x1);
 1140|  30.5M|                    l_current_precinct->y1 = opj_int_min(cbgyend, l_band->y1);
 1141|       |                    /*fprintf(stderr, "\t prc_x0=%d; prc_y0=%d, prc_x1=%d; prc_y1=%d\n",l_current_precinct->x0, l_current_precinct->y0 ,l_current_precinct->x1, l_current_precinct->y1);*/
 1142|       |
 1143|  30.5M|                    tlcblkxstart = opj_int_floordivpow2(l_current_precinct->x0,
 1144|  30.5M|                                                        (OPJ_INT32)cblkwidthexpn) << cblkwidthexpn;
 1145|       |                    /*fprintf(stderr, "\t tlcblkxstart =%d\n",tlcblkxstart );*/
 1146|  30.5M|                    tlcblkystart = opj_int_floordivpow2(l_current_precinct->y0,
 1147|  30.5M|                                                        (OPJ_INT32)cblkheightexpn) << cblkheightexpn;
 1148|       |                    /*fprintf(stderr, "\t tlcblkystart =%d\n",tlcblkystart );*/
 1149|  30.5M|                    brcblkxend = opj_int_ceildivpow2(l_current_precinct->x1,
 1150|  30.5M|                                                     (OPJ_INT32)cblkwidthexpn) << cblkwidthexpn;
 1151|       |                    /*fprintf(stderr, "\t brcblkxend =%d\n",brcblkxend );*/
 1152|  30.5M|                    brcblkyend = opj_int_ceildivpow2(l_current_precinct->y1,
 1153|  30.5M|                                                     (OPJ_INT32)cblkheightexpn) << cblkheightexpn;
 1154|       |                    /*fprintf(stderr, "\t brcblkyend =%d\n",brcblkyend );*/
 1155|  30.5M|                    l_current_precinct->cw = (OPJ_UINT32)((brcblkxend - tlcblkxstart) >>
 1156|  30.5M|                                                          cblkwidthexpn);
 1157|  30.5M|                    l_current_precinct->ch = (OPJ_UINT32)((brcblkyend - tlcblkystart) >>
 1158|  30.5M|                                                          cblkheightexpn);
 1159|       |
 1160|  30.5M|                    l_nb_code_blocks = l_current_precinct->cw * l_current_precinct->ch;
 1161|       |                    /*fprintf(stderr, "\t\t\t\t precinct_cw = %d x recinct_ch = %d\n",l_current_precinct->cw, l_current_precinct->ch);      */
 1162|  30.5M|                    if ((((OPJ_UINT32) - 1) / (OPJ_UINT32)sizeof_block) <
  ------------------
  |  Branch (1162:25): [True: 1, False: 30.5M]
  ------------------
 1163|  30.5M|                            l_nb_code_blocks) {
 1164|      1|                        opj_event_msg(manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1165|      1|                                      "Size of code block data exceeds system limits\n");
 1166|      1|                        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1167|      1|                    }
 1168|  30.5M|                    l_nb_code_blocks_size = l_nb_code_blocks * (OPJ_UINT32)sizeof_block;
 1169|       |
 1170|  30.5M|                    if (!l_current_precinct->cblks.blocks && (l_nb_code_blocks > 0U)) {
  ------------------
  |  Branch (1170:25): [True: 30.3M, False: 160k]
  |  Branch (1170:62): [True: 30.1M, False: 250k]
  ------------------
 1171|  30.1M|                        l_current_precinct->cblks.blocks = opj_malloc(l_nb_code_blocks_size);
 1172|  30.1M|                        if (! l_current_precinct->cblks.blocks) {
  ------------------
  |  Branch (1172:29): [True: 0, False: 30.1M]
  ------------------
 1173|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1174|      0|                        }
 1175|       |                        /*fprintf(stderr, "\t\t\t\tAllocate cblks of a precinct (opj_tcd_cblk_dec_t): %d\n",l_nb_code_blocks_size);*/
 1176|       |
 1177|  30.1M|                        memset(l_current_precinct->cblks.blocks, 0, l_nb_code_blocks_size);
 1178|       |
 1179|  30.1M|                        l_current_precinct->block_size = l_nb_code_blocks_size;
 1180|  30.1M|                    } else if (l_nb_code_blocks_size > l_current_precinct->block_size) {
  ------------------
  |  Branch (1180:32): [True: 8.10k, False: 403k]
  ------------------
 1181|  8.10k|                        void *new_blocks = opj_realloc(l_current_precinct->cblks.blocks,
 1182|  8.10k|                                                       l_nb_code_blocks_size);
 1183|  8.10k|                        if (! new_blocks) {
  ------------------
  |  Branch (1183:29): [True: 0, False: 8.10k]
  ------------------
 1184|      0|                            opj_free(l_current_precinct->cblks.blocks);
 1185|      0|                            l_current_precinct->cblks.blocks = NULL;
 1186|      0|                            l_current_precinct->block_size = 0;
 1187|      0|                            opj_event_msg(manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1188|      0|                                          "Not enough memory for current precinct codeblock element\n");
 1189|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1190|      0|                        }
 1191|  8.10k|                        l_current_precinct->cblks.blocks = new_blocks;
 1192|       |                        /*fprintf(stderr, "\t\t\t\tReallocate cblks of a precinct (opj_tcd_cblk_dec_t): from %d to %d\n",l_current_precinct->block_size, l_nb_code_blocks_size);     */
 1193|       |
 1194|  8.10k|                        memset(((OPJ_BYTE *) l_current_precinct->cblks.blocks) +
 1195|  8.10k|                               l_current_precinct->block_size
 1196|  8.10k|                               , 0
 1197|  8.10k|                               , l_nb_code_blocks_size - l_current_precinct->block_size);
 1198|       |
 1199|  8.10k|                        l_current_precinct->block_size = l_nb_code_blocks_size;
 1200|  8.10k|                    }
 1201|       |
 1202|  30.5M|                    if (! l_current_precinct->incltree) {
  ------------------
  |  Branch (1202:25): [True: 30.3M, False: 159k]
  ------------------
 1203|  30.3M|                        l_current_precinct->incltree = opj_tgt_create(l_current_precinct->cw,
 1204|  30.3M|                                                       l_current_precinct->ch, manager);
 1205|  30.3M|                    } else {
 1206|   159k|                        l_current_precinct->incltree = opj_tgt_init(l_current_precinct->incltree,
 1207|   159k|                                                       l_current_precinct->cw, l_current_precinct->ch, manager);
 1208|   159k|                    }
 1209|       |
 1210|  30.5M|                    if (! l_current_precinct->imsbtree) {
  ------------------
  |  Branch (1210:25): [True: 30.3M, False: 159k]
  ------------------
 1211|  30.3M|                        l_current_precinct->imsbtree = opj_tgt_create(l_current_precinct->cw,
 1212|  30.3M|                                                       l_current_precinct->ch, manager);
 1213|  30.3M|                    } else {
 1214|   159k|                        l_current_precinct->imsbtree = opj_tgt_init(l_current_precinct->imsbtree,
 1215|   159k|                                                       l_current_precinct->cw, l_current_precinct->ch, manager);
 1216|   159k|                    }
 1217|       |
 1218|   301M|                    for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (1218:38): [True: 271M, False: 30.5M]
  ------------------
 1219|   271M|                        OPJ_INT32 cblkxstart = tlcblkxstart + (OPJ_INT32)(cblkno %
 1220|   271M|                                               l_current_precinct->cw) * (1 << cblkwidthexpn);
 1221|   271M|                        OPJ_INT32 cblkystart = tlcblkystart + (OPJ_INT32)(cblkno /
 1222|   271M|                                               l_current_precinct->cw) * (1 << cblkheightexpn);
 1223|   271M|                        OPJ_INT32 cblkxend = cblkxstart + (1 << cblkwidthexpn);
 1224|   271M|                        OPJ_INT32 cblkyend = cblkystart + (1 << cblkheightexpn);
 1225|       |
 1226|   271M|                        if (isEncoder) {
  ------------------
  |  Branch (1226:29): [True: 0, False: 271M]
  ------------------
 1227|      0|                            opj_tcd_cblk_enc_t* l_code_block = l_current_precinct->cblks.enc + cblkno;
 1228|       |
 1229|      0|                            if (! opj_tcd_code_block_enc_allocate(l_code_block)) {
  ------------------
  |  Branch (1229:33): [True: 0, False: 0]
  ------------------
 1230|      0|                                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1231|      0|                            }
 1232|       |                            /* code-block size (global) */
 1233|      0|                            l_code_block->x0 = opj_int_max(cblkxstart, l_current_precinct->x0);
 1234|      0|                            l_code_block->y0 = opj_int_max(cblkystart, l_current_precinct->y0);
 1235|      0|                            l_code_block->x1 = opj_int_min(cblkxend, l_current_precinct->x1);
 1236|      0|                            l_code_block->y1 = opj_int_min(cblkyend, l_current_precinct->y1);
 1237|       |
 1238|      0|                            if (! opj_tcd_code_block_enc_allocate_data(l_code_block)) {
  ------------------
  |  Branch (1238:33): [True: 0, False: 0]
  ------------------
 1239|      0|                                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1240|      0|                            }
 1241|   271M|                        } else {
 1242|   271M|                            opj_tcd_cblk_dec_t* l_code_block = l_current_precinct->cblks.dec + cblkno;
 1243|       |
 1244|   271M|                            if (! opj_tcd_code_block_dec_allocate(l_code_block)) {
  ------------------
  |  Branch (1244:33): [True: 0, False: 271M]
  ------------------
 1245|      0|                                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1246|      0|                            }
 1247|       |                            /* code-block size (global) */
 1248|   271M|                            l_code_block->x0 = opj_int_max(cblkxstart, l_current_precinct->x0);
 1249|   271M|                            l_code_block->y0 = opj_int_max(cblkystart, l_current_precinct->y0);
 1250|   271M|                            l_code_block->x1 = opj_int_min(cblkxend, l_current_precinct->x1);
 1251|   271M|                            l_code_block->y1 = opj_int_min(cblkyend, l_current_precinct->y1);
 1252|   271M|                        }
 1253|   271M|                    }
 1254|  30.5M|                    ++l_current_precinct;
 1255|  30.5M|                } /* precno */
 1256|   566k|            } /* bandno */
 1257|   204k|            ++l_res;
 1258|   204k|        } /* resno */
 1259|  23.8k|        ++l_tccp;
 1260|  23.8k|        ++l_tilec;
 1261|  23.8k|        ++l_image_comp;
 1262|  23.8k|    } /* compno */
 1263|  7.36k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.36k|#define OPJ_TRUE 1
  ------------------
 1264|  7.37k|}
tcd.c:opj_tcd_code_block_dec_allocate:
 1358|   271M|{
 1359|   271M|    if (! p_code_block->segs) {
  ------------------
  |  Branch (1359:9): [True: 247M, False: 23.7M]
  ------------------
 1360|       |
 1361|   247M|        p_code_block->segs = (opj_tcd_seg_t *) opj_calloc(OPJ_J2K_DEFAULT_NB_SEGS,
  ------------------
  |  |  157|   247M|#define OPJ_J2K_DEFAULT_NB_SEGS             10
  ------------------
 1362|   247M|                             sizeof(opj_tcd_seg_t));
 1363|   247M|        if (! p_code_block->segs) {
  ------------------
  |  Branch (1363:13): [True: 0, False: 247M]
  ------------------
 1364|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1365|      0|        }
 1366|       |        /*fprintf(stderr, "Allocate %d elements of code_block->data\n", OPJ_J2K_DEFAULT_NB_SEGS * sizeof(opj_tcd_seg_t));*/
 1367|       |
 1368|   247M|        p_code_block->m_current_max_segs = OPJ_J2K_DEFAULT_NB_SEGS;
  ------------------
  |  |  157|   247M|#define OPJ_J2K_DEFAULT_NB_SEGS             10
  ------------------
 1369|       |        /*fprintf(stderr, "m_current_max_segs of code_block->data = %d\n", p_code_block->m_current_max_segs);*/
 1370|   247M|    } else {
 1371|       |        /* sanitize */
 1372|  23.7M|        opj_tcd_seg_t * l_segs = p_code_block->segs;
 1373|  23.7M|        OPJ_UINT32 l_current_max_segs = p_code_block->m_current_max_segs;
 1374|  23.7M|        opj_tcd_seg_data_chunk_t* l_chunks = p_code_block->chunks;
 1375|  23.7M|        OPJ_UINT32 l_numchunksalloc = p_code_block->numchunksalloc;
 1376|  23.7M|        OPJ_UINT32 i;
 1377|       |
 1378|  23.7M|        opj_aligned_free(p_code_block->decoded_data);
 1379|  23.7M|        p_code_block->decoded_data = 00;
 1380|       |
 1381|  23.7M|        memset(p_code_block, 0, sizeof(opj_tcd_cblk_dec_t));
 1382|  23.7M|        p_code_block->segs = l_segs;
 1383|  23.7M|        p_code_block->m_current_max_segs = l_current_max_segs;
 1384|   261M|        for (i = 0; i < l_current_max_segs; ++i) {
  ------------------
  |  Branch (1384:21): [True: 237M, False: 23.7M]
  ------------------
 1385|   237M|            opj_tcd_reinit_segment(&l_segs[i]);
 1386|   237M|        }
 1387|  23.7M|        p_code_block->chunks = l_chunks;
 1388|  23.7M|        p_code_block->numchunksalloc = l_numchunksalloc;
 1389|  23.7M|    }
 1390|       |
 1391|   271M|    return OPJ_TRUE;
  ------------------
  |  |  117|   271M|#define OPJ_TRUE 1
  ------------------
 1392|   271M|}
tcd.c:opj_tcd_free_tile:
 1923|  7.47k|{
 1924|  7.47k|    OPJ_UINT32 compno, resno, bandno, precno;
 1925|  7.47k|    opj_tcd_tile_t *l_tile = 00;
 1926|  7.47k|    opj_tcd_tilecomp_t *l_tile_comp = 00;
 1927|  7.47k|    opj_tcd_resolution_t *l_res = 00;
 1928|  7.47k|    opj_tcd_band_t *l_band = 00;
 1929|  7.47k|    opj_tcd_precinct_t *l_precinct = 00;
 1930|  7.47k|    OPJ_UINT32 l_nb_resolutions, l_nb_precincts;
 1931|  7.47k|    void (* l_tcd_code_block_deallocate)(opj_tcd_precinct_t *) = 00;
 1932|       |
 1933|  7.47k|    if (! p_tcd) {
  ------------------
  |  Branch (1933:9): [True: 0, False: 7.47k]
  ------------------
 1934|      0|        return;
 1935|      0|    }
 1936|       |
 1937|  7.47k|    if (! p_tcd->tcd_image) {
  ------------------
  |  Branch (1937:9): [True: 0, False: 7.47k]
  ------------------
 1938|      0|        return;
 1939|      0|    }
 1940|       |
 1941|  7.47k|    if (p_tcd->m_is_decoder) {
  ------------------
  |  Branch (1941:9): [True: 7.47k, False: 0]
  ------------------
 1942|  7.47k|        l_tcd_code_block_deallocate = opj_tcd_code_block_dec_deallocate;
 1943|  7.47k|    } else {
 1944|      0|        l_tcd_code_block_deallocate = opj_tcd_code_block_enc_deallocate;
 1945|      0|    }
 1946|       |
 1947|  7.47k|    l_tile = p_tcd->tcd_image->tiles;
 1948|  7.47k|    if (! l_tile) {
  ------------------
  |  Branch (1948:9): [True: 0, False: 7.47k]
  ------------------
 1949|      0|        return;
 1950|      0|    }
 1951|       |
 1952|  7.47k|    l_tile_comp = l_tile->comps;
 1953|       |
 1954|  30.5k|    for (compno = 0; compno < l_tile->numcomps; ++compno) {
  ------------------
  |  Branch (1954:22): [True: 23.0k, False: 7.47k]
  ------------------
 1955|  23.0k|        l_res = l_tile_comp->resolutions;
 1956|  23.0k|        if (l_res) {
  ------------------
  |  Branch (1956:13): [True: 21.6k, False: 1.44k]
  ------------------
 1957|       |
 1958|  21.6k|            l_nb_resolutions = l_tile_comp->resolutions_size / (OPJ_UINT32)sizeof(
 1959|  21.6k|                                   opj_tcd_resolution_t);
 1960|   189k|            for (resno = 0; resno < l_nb_resolutions; ++resno) {
  ------------------
  |  Branch (1960:29): [True: 167k, False: 21.6k]
  ------------------
 1961|   167k|                l_band = l_res->bands;
 1962|   671k|                for (bandno = 0; bandno < 3; ++bandno) {
  ------------------
  |  Branch (1962:34): [True: 503k, False: 167k]
  ------------------
 1963|   503k|                    l_precinct = l_band->precincts;
 1964|   503k|                    if (l_precinct) {
  ------------------
  |  Branch (1964:25): [True: 161k, False: 342k]
  ------------------
 1965|       |
 1966|   161k|                        l_nb_precincts = l_band->precincts_data_size / (OPJ_UINT32)sizeof(
 1967|   161k|                                             opj_tcd_precinct_t);
 1968|  30.5M|                        for (precno = 0; precno < l_nb_precincts; ++precno) {
  ------------------
  |  Branch (1968:42): [True: 30.3M, False: 161k]
  ------------------
 1969|  30.3M|                            opj_tgt_destroy(l_precinct->incltree);
 1970|  30.3M|                            l_precinct->incltree = 00;
 1971|  30.3M|                            opj_tgt_destroy(l_precinct->imsbtree);
 1972|  30.3M|                            l_precinct->imsbtree = 00;
 1973|  30.3M|                            (*l_tcd_code_block_deallocate)(l_precinct);
 1974|  30.3M|                            ++l_precinct;
 1975|  30.3M|                        }
 1976|       |
 1977|   161k|                        opj_free(l_band->precincts);
 1978|   161k|                        l_band->precincts = 00;
 1979|   161k|                    }
 1980|   503k|                    ++l_band;
 1981|   503k|                } /* for (resno */
 1982|   167k|                ++l_res;
 1983|   167k|            }
 1984|       |
 1985|  21.6k|            opj_free(l_tile_comp->resolutions);
 1986|  21.6k|            l_tile_comp->resolutions = 00;
 1987|  21.6k|        }
 1988|       |
 1989|  23.0k|        if (l_tile_comp->ownsData && l_tile_comp->data) {
  ------------------
  |  Branch (1989:13): [True: 13.1k, False: 9.93k]
  |  Branch (1989:38): [True: 7.99k, False: 5.11k]
  ------------------
 1990|  7.99k|            opj_image_data_free(l_tile_comp->data);
 1991|  7.99k|            l_tile_comp->data = 00;
 1992|  7.99k|            l_tile_comp->ownsData = 0;
 1993|  7.99k|            l_tile_comp->data_size = 0;
 1994|  7.99k|            l_tile_comp->data_size_needed = 0;
 1995|  7.99k|        }
 1996|       |
 1997|  23.0k|        opj_image_data_free(l_tile_comp->data_win);
 1998|       |
 1999|  23.0k|        ++l_tile_comp;
 2000|  23.0k|    }
 2001|       |
 2002|  7.47k|    opj_free(l_tile->comps);
 2003|  7.47k|    l_tile->comps = 00;
 2004|  7.47k|    opj_free(p_tcd->tcd_image->tiles);
 2005|  7.47k|    p_tcd->tcd_image->tiles = 00;
 2006|  7.47k|}
tcd.c:opj_tcd_code_block_dec_deallocate:
 2362|  30.3M|{
 2363|  30.3M|    OPJ_UINT32 cblkno, l_nb_code_blocks;
 2364|       |
 2365|  30.3M|    opj_tcd_cblk_dec_t * l_code_block = p_precinct->cblks.dec;
 2366|  30.3M|    if (l_code_block) {
  ------------------
  |  Branch (2366:9): [True: 30.1M, False: 252k]
  ------------------
 2367|       |        /*fprintf(stderr,"deallocate codeblock:{\n");*/
 2368|       |        /*fprintf(stderr,"\t x0=%d, y0=%d, x1=%d, y1=%d\n",l_code_block->x0, l_code_block->y0, l_code_block->x1, l_code_block->y1);*/
 2369|       |        /*fprintf(stderr,"\t numbps=%d, numlenbits=%d, len=%d, numnewpasses=%d, real_num_segs=%d, m_current_max_segs=%d\n ",
 2370|       |                        l_code_block->numbps, l_code_block->numlenbits, l_code_block->len, l_code_block->numnewpasses, l_code_block->real_num_segs, l_code_block->m_current_max_segs );*/
 2371|       |
 2372|       |
 2373|  30.1M|        l_nb_code_blocks = p_precinct->block_size / (OPJ_UINT32)sizeof(
 2374|  30.1M|                               opj_tcd_cblk_dec_t);
 2375|       |        /*fprintf(stderr,"nb_code_blocks =%d\t}\n", l_nb_code_blocks);*/
 2376|       |
 2377|   277M|        for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (2377:26): [True: 247M, False: 30.1M]
  ------------------
 2378|       |
 2379|   247M|            if (l_code_block->segs) {
  ------------------
  |  Branch (2379:17): [True: 247M, False: 0]
  ------------------
 2380|   247M|                opj_free(l_code_block->segs);
 2381|   247M|                l_code_block->segs = 00;
 2382|   247M|            }
 2383|       |
 2384|   247M|            if (l_code_block->chunks) {
  ------------------
  |  Branch (2384:17): [True: 10.8k, False: 247M]
  ------------------
 2385|  10.8k|                opj_free(l_code_block->chunks);
 2386|  10.8k|                l_code_block->chunks = 00;
 2387|  10.8k|            }
 2388|       |
 2389|   247M|            opj_aligned_free(l_code_block->decoded_data);
 2390|   247M|            l_code_block->decoded_data = NULL;
 2391|       |
 2392|   247M|            ++l_code_block;
 2393|   247M|        }
 2394|       |
 2395|  30.1M|        opj_free(p_precinct->cblks.dec);
 2396|  30.1M|        p_precinct->cblks.dec = 00;
 2397|  30.1M|    }
 2398|  30.3M|}
tcd.c:opj_tcd_t2_decode:
 2016|  7.31k|{
 2017|  7.31k|    opj_t2_t * l_t2;
 2018|       |
 2019|  7.31k|    l_t2 = opj_t2_create(p_tcd->image, p_tcd->cp);
 2020|  7.31k|    if (l_t2 == 00) {
  ------------------
  |  Branch (2020:9): [True: 0, False: 7.31k]
  ------------------
 2021|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2022|      0|    }
 2023|       |
 2024|  7.31k|    if (! opj_t2_decode_packets(
  ------------------
  |  Branch (2024:9): [True: 5.06k, False: 2.24k]
  ------------------
 2025|  7.31k|                p_tcd,
 2026|  7.31k|                l_t2,
 2027|  7.31k|                p_tcd->tcd_tileno,
 2028|  7.31k|                p_tcd->tcd_image->tiles,
 2029|  7.31k|                p_src_data,
 2030|  7.31k|                p_data_read,
 2031|  7.31k|                p_max_src_size,
 2032|  7.31k|                p_cstr_index,
 2033|  7.31k|                p_manager)) {
 2034|  5.06k|        opj_t2_destroy(l_t2);
 2035|  5.06k|        return OPJ_FALSE;
  ------------------
  |  |  118|  5.06k|#define OPJ_FALSE 0
  ------------------
 2036|  5.06k|    }
 2037|       |
 2038|  2.24k|    opj_t2_destroy(l_t2);
 2039|       |
 2040|       |    /*---------------CLEAN-------------------*/
 2041|  2.24k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.24k|#define OPJ_TRUE 1
  ------------------
 2042|  7.31k|}
tcd.c:opj_tcd_t1_decode:
 2045|  2.24k|{
 2046|  2.24k|    OPJ_UINT32 compno;
 2047|  2.24k|    opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
 2048|  2.24k|    opj_tcd_tilecomp_t* l_tile_comp = l_tile->comps;
 2049|  2.24k|    opj_tccp_t * l_tccp = p_tcd->tcp->tccps;
 2050|  2.24k|    volatile OPJ_BOOL ret = OPJ_TRUE;
  ------------------
  |  |  117|  2.24k|#define OPJ_TRUE 1
  ------------------
 2051|  2.24k|    OPJ_BOOL check_pterm = OPJ_FALSE;
  ------------------
  |  |  118|  2.24k|#define OPJ_FALSE 0
  ------------------
 2052|  2.24k|    opj_mutex_t* p_manager_mutex = NULL;
 2053|       |
 2054|  2.24k|    p_manager_mutex = opj_mutex_create();
 2055|       |
 2056|       |    /* Only enable PTERM check if we decode all layers */
 2057|  2.24k|    if (p_tcd->tcp->num_layers_to_decode == p_tcd->tcp->numlayers &&
  ------------------
  |  Branch (2057:9): [True: 2.24k, False: 0]
  ------------------
 2058|  2.24k|            (l_tccp->cblksty & J2K_CCP_CBLKSTY_PTERM) != 0) {
  ------------------
  |  |   62|  2.24k|#define J2K_CCP_CBLKSTY_PTERM 0x10    /**< Predictable termination */
  ------------------
  |  Branch (2058:13): [True: 1.80k, False: 444]
  ------------------
 2059|  1.80k|        check_pterm = OPJ_TRUE;
  ------------------
  |  |  117|  1.80k|#define OPJ_TRUE 1
  ------------------
 2060|  1.80k|    }
 2061|       |
 2062|  14.7k|    for (compno = 0; compno < l_tile->numcomps;
  ------------------
  |  Branch (2062:22): [True: 12.6k, False: 2.16k]
  ------------------
 2063|  12.6k|            ++compno, ++l_tile_comp, ++l_tccp) {
 2064|  12.6k|        if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (2064:13): [True: 0, False: 12.6k]
  |  Branch (2064:46): [True: 0, False: 0]
  ------------------
 2065|      0|            continue;
 2066|      0|        }
 2067|       |
 2068|  12.6k|        opj_t1_decode_cblks(p_tcd, &ret, l_tile_comp, l_tccp,
 2069|  12.6k|                            p_manager, p_manager_mutex, check_pterm);
 2070|  12.6k|        if (!ret) {
  ------------------
  |  Branch (2070:13): [True: 83, False: 12.5k]
  ------------------
 2071|     83|            break;
 2072|     83|        }
 2073|  12.6k|    }
 2074|       |
 2075|  2.24k|    opj_thread_pool_wait_completion(p_tcd->thread_pool, 0);
 2076|  2.24k|    if (p_manager_mutex) {
  ------------------
  |  Branch (2076:9): [True: 2.24k, False: 0]
  ------------------
 2077|  2.24k|        opj_mutex_destroy(p_manager_mutex);
 2078|  2.24k|    }
 2079|  2.24k|    return ret;
 2080|  2.24k|}
tcd.c:opj_tcd_dwt_decode:
 2084|  2.16k|{
 2085|  2.16k|    OPJ_UINT32 compno;
 2086|  2.16k|    opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
 2087|  2.16k|    opj_tcd_tilecomp_t * l_tile_comp = l_tile->comps;
 2088|  2.16k|    opj_tccp_t * l_tccp = p_tcd->tcp->tccps;
 2089|  2.16k|    opj_image_comp_t * l_img_comp = p_tcd->image->comps;
 2090|       |
 2091|  14.4k|    for (compno = 0; compno < l_tile->numcomps;
  ------------------
  |  Branch (2091:22): [True: 12.2k, False: 2.16k]
  ------------------
 2092|  12.2k|            compno++, ++l_tile_comp, ++l_img_comp, ++l_tccp) {
 2093|  12.2k|        if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (2093:13): [True: 0, False: 12.2k]
  |  Branch (2093:46): [True: 0, False: 0]
  ------------------
 2094|      0|            continue;
 2095|      0|        }
 2096|       |
 2097|  12.2k|        if (l_tccp->qmfbid == 1) {
  ------------------
  |  Branch (2097:13): [True: 8.90k, False: 3.36k]
  ------------------
 2098|  8.90k|            if (! opj_dwt_decode(p_tcd, l_tile_comp,
  ------------------
  |  Branch (2098:17): [True: 0, False: 8.90k]
  ------------------
 2099|  8.90k|                                 l_img_comp->resno_decoded + 1)) {
 2100|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2101|      0|            }
 2102|  8.90k|        } else {
 2103|  3.36k|            if (! opj_dwt_decode_real(p_tcd, l_tile_comp,
  ------------------
  |  Branch (2103:17): [True: 0, False: 3.36k]
  ------------------
 2104|  3.36k|                                      l_img_comp->resno_decoded + 1)) {
 2105|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2106|      0|            }
 2107|  3.36k|        }
 2108|       |
 2109|  12.2k|    }
 2110|       |
 2111|  2.16k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.16k|#define OPJ_TRUE 1
  ------------------
 2112|  2.16k|}
tcd.c:opj_tcd_mct_decode:
 2115|  2.16k|{
 2116|  2.16k|    opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
 2117|  2.16k|    opj_tcp_t * l_tcp = p_tcd->tcp;
 2118|  2.16k|    opj_tcd_tilecomp_t * l_tile_comp = l_tile->comps;
 2119|  2.16k|    OPJ_SIZE_T l_samples;
 2120|  2.16k|    OPJ_UINT32 i;
 2121|       |
 2122|  2.16k|    if (l_tcp->mct == 0 || p_tcd->used_component != NULL) {
  ------------------
  |  Branch (2122:9): [True: 1.77k, False: 393]
  |  Branch (2122:28): [True: 0, False: 393]
  ------------------
 2123|  1.77k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.77k|#define OPJ_TRUE 1
  ------------------
 2124|  1.77k|    }
 2125|       |
 2126|    393|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2126:9): [True: 142, False: 251]
  ------------------
 2127|    142|        opj_tcd_resolution_t* res_comp0 = l_tile->comps[0].resolutions +
 2128|    142|                                          l_tile_comp->minimum_num_resolutions - 1;
 2129|       |
 2130|       |        /* A bit inefficient: we process more data than needed if */
 2131|       |        /* resno_decoded < l_tile_comp->minimum_num_resolutions-1, */
 2132|       |        /* but we would need to take into account a stride then */
 2133|    142|        l_samples = (OPJ_SIZE_T)(res_comp0->x1 - res_comp0->x0) *
 2134|    142|                    (OPJ_SIZE_T)(res_comp0->y1 - res_comp0->y0);
 2135|    142|        if (l_tile->numcomps >= 3) {
  ------------------
  |  Branch (2135:13): [True: 110, False: 32]
  ------------------
 2136|    110|            if (l_tile_comp->minimum_num_resolutions !=
  ------------------
  |  Branch (2136:17): [True: 1, False: 109]
  ------------------
 2137|    110|                    l_tile->comps[1].minimum_num_resolutions ||
 2138|    110|                    l_tile_comp->minimum_num_resolutions !=
  ------------------
  |  Branch (2138:21): [True: 0, False: 109]
  ------------------
 2139|    109|                    l_tile->comps[2].minimum_num_resolutions) {
 2140|      1|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2141|      1|                              "Tiles don't all have the same dimension. Skip the MCT step.\n");
 2142|      1|                return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 2143|      1|            }
 2144|    110|        }
 2145|    141|        if (l_tile->numcomps >= 3) {
  ------------------
  |  Branch (2145:13): [True: 109, False: 32]
  ------------------
 2146|    109|            opj_tcd_resolution_t* res_comp1 = l_tile->comps[1].resolutions +
 2147|    109|                                              l_tile_comp->minimum_num_resolutions - 1;
 2148|    109|            opj_tcd_resolution_t* res_comp2 = l_tile->comps[2].resolutions +
 2149|    109|                                              l_tile_comp->minimum_num_resolutions - 1;
 2150|       |            /* testcase 1336.pdf.asan.47.376 */
 2151|    109|            if (p_tcd->image->comps[0].resno_decoded !=
  ------------------
  |  Branch (2151:17): [True: 3, False: 106]
  ------------------
 2152|    109|                    p_tcd->image->comps[1].resno_decoded ||
 2153|    109|                    p_tcd->image->comps[0].resno_decoded !=
  ------------------
  |  Branch (2153:21): [True: 0, False: 106]
  ------------------
 2154|    106|                    p_tcd->image->comps[2].resno_decoded ||
 2155|    109|                    (OPJ_SIZE_T)(res_comp1->x1 - res_comp1->x0) *
  ------------------
  |  Branch (2155:21): [True: 1, False: 105]
  ------------------
 2156|    106|                    (OPJ_SIZE_T)(res_comp1->y1 - res_comp1->y0) != l_samples ||
 2157|    109|                    (OPJ_SIZE_T)(res_comp2->x1 - res_comp2->x0) *
  ------------------
  |  Branch (2157:21): [True: 1, False: 104]
  ------------------
 2158|    105|                    (OPJ_SIZE_T)(res_comp2->y1 - res_comp2->y0) != l_samples) {
 2159|      5|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2160|      5|                              "Tiles don't all have the same dimension. Skip the MCT step.\n");
 2161|      5|                return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 2162|      5|            }
 2163|    109|        }
 2164|    251|    } else {
 2165|    251|        opj_tcd_resolution_t* res_comp0 = l_tile->comps[0].resolutions +
 2166|    251|                                          p_tcd->image->comps[0].resno_decoded;
 2167|       |
 2168|    251|        l_samples = (OPJ_SIZE_T)(res_comp0->win_x1 - res_comp0->win_x0) *
 2169|    251|                    (OPJ_SIZE_T)(res_comp0->win_y1 - res_comp0->win_y0);
 2170|    251|        if (l_tile->numcomps >= 3) {
  ------------------
  |  Branch (2170:13): [True: 180, False: 71]
  ------------------
 2171|    180|            opj_tcd_resolution_t* res_comp1 = l_tile->comps[1].resolutions +
 2172|    180|                                              p_tcd->image->comps[1].resno_decoded;
 2173|    180|            opj_tcd_resolution_t* res_comp2 = l_tile->comps[2].resolutions +
 2174|    180|                                              p_tcd->image->comps[2].resno_decoded;
 2175|       |            /* testcase 1336.pdf.asan.47.376 */
 2176|    180|            if (p_tcd->image->comps[0].resno_decoded !=
  ------------------
  |  Branch (2176:17): [True: 2, False: 178]
  ------------------
 2177|    180|                    p_tcd->image->comps[1].resno_decoded ||
 2178|    180|                    p_tcd->image->comps[0].resno_decoded !=
  ------------------
  |  Branch (2178:21): [True: 3, False: 175]
  ------------------
 2179|    178|                    p_tcd->image->comps[2].resno_decoded ||
 2180|    180|                    (OPJ_SIZE_T)(res_comp1->win_x1 - res_comp1->win_x0) *
  ------------------
  |  Branch (2180:21): [True: 7, False: 168]
  ------------------
 2181|    175|                    (OPJ_SIZE_T)(res_comp1->win_y1 - res_comp1->win_y0) != l_samples ||
 2182|    180|                    (OPJ_SIZE_T)(res_comp2->win_x1 - res_comp2->win_x0) *
  ------------------
  |  Branch (2182:21): [True: 1, False: 167]
  ------------------
 2183|    168|                    (OPJ_SIZE_T)(res_comp2->win_y1 - res_comp2->win_y0) != l_samples) {
 2184|     13|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     13|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2185|     13|                              "Tiles don't all have the same dimension. Skip the MCT step.\n");
 2186|     13|                return OPJ_FALSE;
  ------------------
  |  |  118|     13|#define OPJ_FALSE 0
  ------------------
 2187|     13|            }
 2188|    180|        }
 2189|    251|    }
 2190|       |
 2191|    374|    if (l_tile->numcomps >= 3) {
  ------------------
  |  Branch (2191:9): [True: 271, False: 103]
  ------------------
 2192|    271|        if (l_tcp->mct == 2) {
  ------------------
  |  Branch (2192:13): [True: 0, False: 271]
  ------------------
 2193|      0|            OPJ_BYTE ** l_data;
 2194|       |
 2195|      0|            if (! l_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (2195:17): [True: 0, False: 0]
  ------------------
 2196|      0|                return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 2197|      0|            }
 2198|       |
 2199|      0|            l_data = (OPJ_BYTE **) opj_malloc(l_tile->numcomps * sizeof(OPJ_BYTE*));
 2200|      0|            if (! l_data) {
  ------------------
  |  Branch (2200:17): [True: 0, False: 0]
  ------------------
 2201|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2202|      0|            }
 2203|       |
 2204|      0|            for (i = 0; i < l_tile->numcomps; ++i) {
  ------------------
  |  Branch (2204:25): [True: 0, False: 0]
  ------------------
 2205|      0|                if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2205:21): [True: 0, False: 0]
  ------------------
 2206|      0|                    l_data[i] = (OPJ_BYTE*) l_tile_comp->data;
 2207|      0|                } else {
 2208|      0|                    l_data[i] = (OPJ_BYTE*) l_tile_comp->data_win;
 2209|      0|                }
 2210|      0|                ++l_tile_comp;
 2211|      0|            }
 2212|       |
 2213|      0|            if (! opj_mct_decode_custom(/* MCT data */
  ------------------
  |  Branch (2213:17): [True: 0, False: 0]
  ------------------
 2214|      0|                        (OPJ_BYTE*) l_tcp->m_mct_decoding_matrix,
 2215|       |                        /* size of components */
 2216|      0|                        l_samples,
 2217|       |                        /* components */
 2218|      0|                        l_data,
 2219|       |                        /* nb of components (i.e. size of pData) */
 2220|      0|                        l_tile->numcomps,
 2221|       |                        /* tells if the data is signed */
 2222|      0|                        p_tcd->image->comps->sgnd)) {
 2223|      0|                opj_free(l_data);
 2224|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2225|      0|            }
 2226|       |
 2227|      0|            opj_free(l_data);
 2228|    271|        } else {
 2229|    271|            if (l_tcp->tccps->qmfbid == 1) {
  ------------------
  |  Branch (2229:17): [True: 58, False: 213]
  ------------------
 2230|     58|                if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2230:21): [True: 22, False: 36]
  ------------------
 2231|     22|                    opj_mct_decode(l_tile->comps[0].data,
 2232|     22|                                   l_tile->comps[1].data,
 2233|     22|                                   l_tile->comps[2].data,
 2234|     22|                                   l_samples);
 2235|     36|                } else {
 2236|     36|                    opj_mct_decode(l_tile->comps[0].data_win,
 2237|     36|                                   l_tile->comps[1].data_win,
 2238|     36|                                   l_tile->comps[2].data_win,
 2239|     36|                                   l_samples);
 2240|     36|                }
 2241|    213|            } else {
 2242|    213|                if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2242:21): [True: 82, False: 131]
  ------------------
 2243|     82|                    opj_mct_decode_real((OPJ_FLOAT32*)l_tile->comps[0].data,
 2244|     82|                                        (OPJ_FLOAT32*)l_tile->comps[1].data,
 2245|     82|                                        (OPJ_FLOAT32*)l_tile->comps[2].data,
 2246|     82|                                        l_samples);
 2247|    131|                } else {
 2248|    131|                    opj_mct_decode_real((OPJ_FLOAT32*)l_tile->comps[0].data_win,
 2249|    131|                                        (OPJ_FLOAT32*)l_tile->comps[1].data_win,
 2250|    131|                                        (OPJ_FLOAT32*)l_tile->comps[2].data_win,
 2251|    131|                                        l_samples);
 2252|    131|                }
 2253|    213|            }
 2254|    271|        }
 2255|    271|    } else {
 2256|    103|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    103|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2257|    103|                      "Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",
 2258|    103|                      l_tile->numcomps);
 2259|    103|    }
 2260|       |
 2261|    374|    return OPJ_TRUE;
  ------------------
  |  |  117|    374|#define OPJ_TRUE 1
  ------------------
 2262|    374|}
tcd.c:opj_tcd_dc_level_shift_decode:
 2266|  2.14k|{
 2267|  2.14k|    OPJ_UINT32 compno;
 2268|  2.14k|    opj_tcd_tilecomp_t * l_tile_comp = 00;
 2269|  2.14k|    opj_tccp_t * l_tccp = 00;
 2270|  2.14k|    opj_image_comp_t * l_img_comp = 00;
 2271|  2.14k|    opj_tcd_resolution_t* l_res = 00;
 2272|  2.14k|    opj_tcd_tile_t * l_tile;
 2273|  2.14k|    OPJ_UINT32 l_width, l_height, i, j;
 2274|  2.14k|    OPJ_INT32 * l_current_ptr;
 2275|  2.14k|    OPJ_INT32 l_min, l_max;
 2276|  2.14k|    OPJ_UINT32 l_stride;
 2277|       |
 2278|  2.14k|    l_tile = p_tcd->tcd_image->tiles;
 2279|  2.14k|    l_tile_comp = l_tile->comps;
 2280|  2.14k|    l_tccp = p_tcd->tcp->tccps;
 2281|  2.14k|    l_img_comp = p_tcd->image->comps;
 2282|       |
 2283|  13.8k|    for (compno = 0; compno < l_tile->numcomps;
  ------------------
  |  Branch (2283:22): [True: 11.7k, False: 2.14k]
  ------------------
 2284|  11.7k|            compno++, ++l_img_comp, ++l_tccp, ++l_tile_comp) {
 2285|       |
 2286|  11.7k|        if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (2286:13): [True: 0, False: 11.7k]
  |  Branch (2286:46): [True: 0, False: 0]
  ------------------
 2287|      0|            continue;
 2288|      0|        }
 2289|       |
 2290|  11.7k|        l_res = l_tile_comp->resolutions + l_img_comp->resno_decoded;
 2291|       |
 2292|  11.7k|        if (!p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2292:13): [True: 4.15k, False: 7.56k]
  ------------------
 2293|  4.15k|            l_width = l_res->win_x1 - l_res->win_x0;
 2294|  4.15k|            l_height = l_res->win_y1 - l_res->win_y0;
 2295|  4.15k|            l_stride = 0;
 2296|  4.15k|            l_current_ptr = l_tile_comp->data_win;
 2297|  7.56k|        } else {
 2298|  7.56k|            l_width = (OPJ_UINT32)(l_res->x1 - l_res->x0);
 2299|  7.56k|            l_height = (OPJ_UINT32)(l_res->y1 - l_res->y0);
 2300|  7.56k|            l_stride = (OPJ_UINT32)(
 2301|  7.56k|                           l_tile_comp->resolutions[l_tile_comp->minimum_num_resolutions - 1].x1 -
 2302|  7.56k|                           l_tile_comp->resolutions[l_tile_comp->minimum_num_resolutions - 1].x0)
 2303|  7.56k|                       - l_width;
 2304|  7.56k|            l_current_ptr = l_tile_comp->data;
 2305|       |
 2306|  7.56k|            assert(l_height == 0 ||
 2307|  7.56k|                   l_width + l_stride <= l_tile_comp->data_size / l_height); /*MUPDF*/
 2308|  7.56k|        }
 2309|       |
 2310|  11.7k|        if (l_img_comp->sgnd) {
  ------------------
  |  Branch (2310:13): [True: 2.80k, False: 8.90k]
  ------------------
 2311|  2.80k|            l_min = -(1 << (l_img_comp->prec - 1));
 2312|  2.80k|            l_max = (1 << (l_img_comp->prec - 1)) - 1;
 2313|  8.90k|        } else {
 2314|  8.90k|            l_min = 0;
 2315|  8.90k|            l_max = (OPJ_INT32)((1U << l_img_comp->prec) - 1);
 2316|  8.90k|        }
 2317|       |
 2318|  11.7k|        if (l_width == 0 || l_height == 0) {
  ------------------
  |  Branch (2318:13): [True: 2.22k, False: 9.49k]
  |  Branch (2318:29): [True: 525, False: 8.96k]
  ------------------
 2319|  2.74k|            continue;
 2320|  2.74k|        }
 2321|       |
 2322|  8.96k|        if (l_tccp->qmfbid == 1) {
  ------------------
  |  Branch (2322:13): [True: 6.75k, False: 2.21k]
  ------------------
 2323|  1.83M|            for (j = 0; j < l_height; ++j) {
  ------------------
  |  Branch (2323:25): [True: 1.83M, False: 6.75k]
  ------------------
 2324|   252M|                for (i = 0; i < l_width; ++i) {
  ------------------
  |  Branch (2324:29): [True: 250M, False: 1.83M]
  ------------------
 2325|       |                    /* TODO: do addition on int64 ? */
 2326|   250M|                    *l_current_ptr = opj_int_clamp(*l_current_ptr + l_tccp->m_dc_level_shift, l_min,
 2327|   250M|                                                   l_max);
 2328|   250M|                    ++l_current_ptr;
 2329|   250M|                }
 2330|  1.83M|                l_current_ptr += l_stride;
 2331|  1.83M|            }
 2332|  6.75k|        } else {
 2333|   416k|            for (j = 0; j < l_height; ++j) {
  ------------------
  |  Branch (2333:25): [True: 414k, False: 2.21k]
  ------------------
 2334|   121M|                for (i = 0; i < l_width; ++i) {
  ------------------
  |  Branch (2334:29): [True: 120M, False: 414k]
  ------------------
 2335|   120M|                    OPJ_FLOAT32 l_value = *((OPJ_FLOAT32 *) l_current_ptr);
 2336|   120M|                    if (l_value > (OPJ_FLOAT32)INT_MAX) {
  ------------------
  |  Branch (2336:25): [True: 349, False: 120M]
  ------------------
 2337|    349|                        *l_current_ptr = l_max;
 2338|   120M|                    } else if (l_value < INT_MIN) {
  ------------------
  |  Branch (2338:32): [True: 342, False: 120M]
  ------------------
 2339|    342|                        *l_current_ptr = l_min;
 2340|   120M|                    } else {
 2341|       |                        /* Do addition on int64 to avoid overflows */
 2342|   120M|                        OPJ_INT64 l_value_int = (OPJ_INT64)opj_lrintf(l_value);
 2343|   120M|                        *l_current_ptr = (OPJ_INT32)opj_int64_clamp(
 2344|   120M|                                             l_value_int + l_tccp->m_dc_level_shift, l_min, l_max);
 2345|   120M|                    }
 2346|   120M|                    ++l_current_ptr;
 2347|   120M|                }
 2348|   414k|                l_current_ptr += l_stride;
 2349|   414k|            }
 2350|  2.21k|        }
 2351|  8.96k|    }
 2352|       |
 2353|  2.14k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.14k|#define OPJ_TRUE 1
  ------------------
 2354|  2.14k|}
tcd.c:opj_tcd_is_whole_tilecomp_decoding:
 2873|  17.7k|{
 2874|  17.7k|    opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
 2875|  17.7k|    opj_image_comp_t* image_comp = &(p_tcd->image->comps[compno]);
 2876|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 2877|       |    /* with the tile coordinates */
 2878|  17.7k|    OPJ_UINT32 tcx0 = opj_uint_max(
 2879|  17.7k|                          (OPJ_UINT32)tilec->x0,
 2880|  17.7k|                          opj_uint_ceildiv(p_tcd->win_x0, image_comp->dx));
 2881|  17.7k|    OPJ_UINT32 tcy0 = opj_uint_max(
 2882|  17.7k|                          (OPJ_UINT32)tilec->y0,
 2883|  17.7k|                          opj_uint_ceildiv(p_tcd->win_y0, image_comp->dy));
 2884|  17.7k|    OPJ_UINT32 tcx1 = opj_uint_min(
 2885|  17.7k|                          (OPJ_UINT32)tilec->x1,
 2886|  17.7k|                          opj_uint_ceildiv(p_tcd->win_x1, image_comp->dx));
 2887|  17.7k|    OPJ_UINT32 tcy1 = opj_uint_min(
 2888|  17.7k|                          (OPJ_UINT32)tilec->y1,
 2889|  17.7k|                          opj_uint_ceildiv(p_tcd->win_y1, image_comp->dy));
 2890|       |
 2891|  17.7k|    OPJ_UINT32 shift = tilec->numresolutions - tilec->minimum_num_resolutions;
 2892|       |    /* Tolerate small margin within the reduced resolution factor to consider if */
 2893|       |    /* the whole tile path must be taken */
 2894|  17.7k|    return (tcx0 >= (OPJ_UINT32)tilec->x0 &&
  ------------------
  |  Branch (2894:13): [True: 17.7k, False: 0]
  ------------------
 2895|  17.7k|            tcy0 >= (OPJ_UINT32)tilec->y0 &&
  ------------------
  |  Branch (2895:13): [True: 17.7k, False: 0]
  ------------------
 2896|  17.7k|            tcx1 <= (OPJ_UINT32)tilec->x1 &&
  ------------------
  |  Branch (2896:13): [True: 17.7k, False: 0]
  ------------------
 2897|  17.7k|            tcy1 <= (OPJ_UINT32)tilec->y1 &&
  ------------------
  |  Branch (2897:13): [True: 17.7k, False: 0]
  ------------------
 2898|  17.7k|            (shift >= 32 ||
  ------------------
  |  Branch (2898:14): [True: 0, False: 17.7k]
  ------------------
 2899|  17.7k|             (((tcx0 - (OPJ_UINT32)tilec->x0) >> shift) == 0 &&
  ------------------
  |  Branch (2899:15): [True: 17.7k, False: 0]
  ------------------
 2900|  17.7k|              ((tcy0 - (OPJ_UINT32)tilec->y0) >> shift) == 0 &&
  ------------------
  |  Branch (2900:15): [True: 17.7k, False: 0]
  ------------------
 2901|  17.7k|              (((OPJ_UINT32)tilec->x1 - tcx1) >> shift) == 0 &&
  ------------------
  |  Branch (2901:15): [True: 15.6k, False: 2.08k]
  ------------------
 2902|  17.7k|              (((OPJ_UINT32)tilec->y1 - tcy1) >> shift) == 0)));
  ------------------
  |  Branch (2902:15): [True: 14.5k, False: 1.09k]
  ------------------
 2903|  17.7k|}

opj_tgt_create:
   50|  60.7M|{
   51|  60.7M|    OPJ_INT32 nplh[32];
   52|  60.7M|    OPJ_INT32 nplv[32];
   53|  60.7M|    opj_tgt_node_t *node = 00;
   54|  60.7M|    opj_tgt_node_t *l_parent_node = 00;
   55|  60.7M|    opj_tgt_node_t *l_parent_node0 = 00;
   56|  60.7M|    opj_tgt_tree_t *tree = 00;
   57|  60.7M|    OPJ_UINT32 i;
   58|  60.7M|    OPJ_INT32  j, k;
   59|  60.7M|    OPJ_UINT32 numlvls;
   60|  60.7M|    OPJ_UINT32 n;
   61|       |
   62|  60.7M|    tree = (opj_tgt_tree_t *) opj_calloc(1, sizeof(opj_tgt_tree_t));
   63|  60.7M|    if (!tree) {
  ------------------
  |  Branch (63:9): [True: 0, False: 60.7M]
  ------------------
   64|      0|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to create Tag-tree\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
   65|      0|        return 00;
   66|      0|    }
   67|       |
   68|  60.7M|    tree->numleafsh = numleafsh;
   69|  60.7M|    tree->numleafsv = numleafsv;
   70|       |
   71|  60.7M|    numlvls = 0;
   72|  60.7M|    nplh[0] = (OPJ_INT32)numleafsh;
   73|  60.7M|    nplv[0] = (OPJ_INT32)numleafsv;
   74|  60.7M|    tree->numnodes = 0;
   75|  95.4M|    do {
   76|  95.4M|        n = (OPJ_UINT32)(nplh[numlvls] * nplv[numlvls]);
   77|  95.4M|        nplh[numlvls + 1] = (nplh[numlvls] + 1) / 2;
   78|  95.4M|        nplv[numlvls + 1] = (nplv[numlvls] + 1) / 2;
   79|  95.4M|        tree->numnodes += n;
   80|  95.4M|        ++numlvls;
   81|  95.4M|    } while (n > 1);
  ------------------
  |  Branch (81:14): [True: 34.7M, False: 60.7M]
  ------------------
   82|       |
   83|       |    /* ADD */
   84|  60.7M|    if (tree->numnodes == 0) {
  ------------------
  |  Branch (84:9): [True: 501k, False: 60.2M]
  ------------------
   85|   501k|        opj_free(tree);
   86|   501k|        return 00;
   87|   501k|    }
   88|       |
   89|  60.2M|    tree->nodes = (opj_tgt_node_t*) opj_calloc(tree->numnodes,
   90|  60.2M|                  sizeof(opj_tgt_node_t));
   91|  60.2M|    if (!tree->nodes) {
  ------------------
  |  Branch (91:9): [True: 0, False: 60.2M]
  ------------------
   92|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
   93|      0|                      "Not enough memory to create Tag-tree nodes\n");
   94|      0|        opj_free(tree);
   95|      0|        return 00;
   96|      0|    }
   97|  60.2M|    tree->nodes_size = tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t);
   98|       |
   99|  60.2M|    node = tree->nodes;
  100|  60.2M|    l_parent_node = &tree->nodes[tree->numleafsh * tree->numleafsv];
  101|  60.2M|    l_parent_node0 = l_parent_node;
  102|       |
  103|  94.9M|    for (i = 0; i < numlvls - 1; ++i) {
  ------------------
  |  Branch (103:17): [True: 34.7M, False: 60.2M]
  ------------------
  104|   431M|        for (j = 0; j < nplv[i]; ++j) {
  ------------------
  |  Branch (104:21): [True: 396M, False: 34.7M]
  ------------------
  105|   396M|            k = nplh[i];
  106|   984M|            while (--k >= 0) {
  ------------------
  |  Branch (106:20): [True: 588M, False: 396M]
  ------------------
  107|   588M|                node->parent = l_parent_node;
  108|   588M|                ++node;
  109|   588M|                if (--k >= 0) {
  ------------------
  |  Branch (109:21): [True: 209M, False: 379M]
  ------------------
  110|   209M|                    node->parent = l_parent_node;
  111|   209M|                    ++node;
  112|   209M|                }
  113|   588M|                ++l_parent_node;
  114|   588M|            }
  115|   396M|            if ((j & 1) || j == nplv[i] - 1) {
  ------------------
  |  Branch (115:17): [True: 192M, False: 203M]
  |  Branch (115:28): [True: 10.6M, False: 192M]
  ------------------
  116|   203M|                l_parent_node0 = l_parent_node;
  117|   203M|            } else {
  118|   192M|                l_parent_node = l_parent_node0;
  119|   192M|                l_parent_node0 += nplh[i];
  120|   192M|            }
  121|   396M|        }
  122|  34.7M|    }
  123|  60.2M|    node->parent = 0;
  124|  60.2M|    opj_tgt_reset(tree);
  125|  60.2M|    return tree;
  126|  60.2M|}
opj_tgt_init:
  138|   319k|{
  139|   319k|    OPJ_INT32 l_nplh[32];
  140|   319k|    OPJ_INT32 l_nplv[32];
  141|   319k|    opj_tgt_node_t *l_node = 00;
  142|   319k|    opj_tgt_node_t *l_parent_node = 00;
  143|   319k|    opj_tgt_node_t *l_parent_node0 = 00;
  144|   319k|    OPJ_UINT32 i;
  145|   319k|    OPJ_INT32 j, k;
  146|   319k|    OPJ_UINT32 l_num_levels;
  147|   319k|    OPJ_UINT32 n;
  148|   319k|    OPJ_UINT32 l_node_size;
  149|       |
  150|   319k|    if (! p_tree) {
  ------------------
  |  Branch (150:9): [True: 0, False: 319k]
  ------------------
  151|      0|        return 00;
  152|      0|    }
  153|       |
  154|   319k|    if ((p_tree->numleafsh != p_num_leafs_h) ||
  ------------------
  |  Branch (154:9): [True: 2.02k, False: 317k]
  ------------------
  155|   319k|            (p_tree->numleafsv != p_num_leafs_v)) {
  ------------------
  |  Branch (155:13): [True: 23.8k, False: 293k]
  ------------------
  156|  25.8k|        p_tree->numleafsh = p_num_leafs_h;
  157|  25.8k|        p_tree->numleafsv = p_num_leafs_v;
  158|       |
  159|  25.8k|        l_num_levels = 0;
  160|  25.8k|        l_nplh[0] = (OPJ_INT32)p_num_leafs_h;
  161|  25.8k|        l_nplv[0] = (OPJ_INT32)p_num_leafs_v;
  162|  25.8k|        p_tree->numnodes = 0;
  163|   161k|        do {
  164|   161k|            n = (OPJ_UINT32)(l_nplh[l_num_levels] * l_nplv[l_num_levels]);
  165|   161k|            l_nplh[l_num_levels + 1] = (l_nplh[l_num_levels] + 1) / 2;
  166|   161k|            l_nplv[l_num_levels + 1] = (l_nplv[l_num_levels] + 1) / 2;
  167|   161k|            p_tree->numnodes += n;
  168|   161k|            ++l_num_levels;
  169|   161k|        } while (n > 1);
  ------------------
  |  Branch (169:18): [True: 135k, False: 25.8k]
  ------------------
  170|       |
  171|       |        /* ADD */
  172|  25.8k|        if (p_tree->numnodes == 0) {
  ------------------
  |  Branch (172:13): [True: 1.00k, False: 24.8k]
  ------------------
  173|  1.00k|            opj_tgt_destroy(p_tree);
  174|  1.00k|            return 00;
  175|  1.00k|        }
  176|  24.8k|        l_node_size = p_tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t);
  177|       |
  178|  24.8k|        if (l_node_size > p_tree->nodes_size) {
  ------------------
  |  Branch (178:13): [True: 16.2k, False: 8.64k]
  ------------------
  179|  16.2k|            opj_tgt_node_t* new_nodes = (opj_tgt_node_t*) opj_realloc(p_tree->nodes,
  180|  16.2k|                                        l_node_size);
  181|  16.2k|            if (! new_nodes) {
  ------------------
  |  Branch (181:17): [True: 0, False: 16.2k]
  ------------------
  182|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  183|      0|                              "Not enough memory to reinitialize the tag tree\n");
  184|      0|                opj_tgt_destroy(p_tree);
  185|      0|                return 00;
  186|      0|            }
  187|  16.2k|            p_tree->nodes = new_nodes;
  188|  16.2k|            memset(((char *) p_tree->nodes) + p_tree->nodes_size, 0,
  189|  16.2k|                   l_node_size - p_tree->nodes_size);
  190|  16.2k|            p_tree->nodes_size = l_node_size;
  191|  16.2k|        }
  192|  24.8k|        l_node = p_tree->nodes;
  193|  24.8k|        l_parent_node = &p_tree->nodes[p_tree->numleafsh * p_tree->numleafsv];
  194|  24.8k|        l_parent_node0 = l_parent_node;
  195|       |
  196|   160k|        for (i = 0; i < l_num_levels - 1; ++i) {
  ------------------
  |  Branch (196:21): [True: 135k, False: 24.8k]
  ------------------
  197|   326k|            for (j = 0; j < l_nplv[i]; ++j) {
  ------------------
  |  Branch (197:25): [True: 191k, False: 135k]
  ------------------
  198|   191k|                k = l_nplh[i];
  199|  6.07M|                while (--k >= 0) {
  ------------------
  |  Branch (199:24): [True: 5.87M, False: 191k]
  ------------------
  200|  5.87M|                    l_node->parent = l_parent_node;
  201|  5.87M|                    ++l_node;
  202|  5.87M|                    if (--k >= 0) {
  ------------------
  |  Branch (202:25): [True: 5.84M, False: 32.2k]
  ------------------
  203|  5.84M|                        l_node->parent = l_parent_node;
  204|  5.84M|                        ++l_node;
  205|  5.84M|                    }
  206|  5.87M|                    ++l_parent_node;
  207|  5.87M|                }
  208|   191k|                if ((j & 1) || j == l_nplv[i] - 1) {
  ------------------
  |  Branch (208:21): [True: 36.8k, False: 154k]
  |  Branch (208:32): [True: 117k, False: 36.8k]
  ------------------
  209|   154k|                    l_parent_node0 = l_parent_node;
  210|   154k|                } else {
  211|  36.8k|                    l_parent_node = l_parent_node0;
  212|  36.8k|                    l_parent_node0 += l_nplh[i];
  213|  36.8k|                }
  214|   191k|            }
  215|   135k|        }
  216|  24.8k|        l_node->parent = 0;
  217|  24.8k|    }
  218|   318k|    opj_tgt_reset(p_tree);
  219|       |
  220|   318k|    return p_tree;
  221|   319k|}
opj_tgt_destroy:
  224|  60.7M|{
  225|  60.7M|    if (! p_tree) {
  ------------------
  |  Branch (225:9): [True: 505k, False: 60.2M]
  ------------------
  226|   505k|        return;
  227|   505k|    }
  228|       |
  229|  60.2M|    if (p_tree->nodes) {
  ------------------
  |  Branch (229:9): [True: 60.2M, False: 0]
  ------------------
  230|  60.2M|        opj_free(p_tree->nodes);
  231|  60.2M|        p_tree->nodes = 00;
  232|  60.2M|    }
  233|  60.2M|    opj_free(p_tree);
  234|  60.2M|}
opj_tgt_reset:
  237|  61.7M|{
  238|  61.7M|    OPJ_UINT32 i;
  239|  61.7M|    opj_tgt_node_t * l_current_node = 00;;
  240|       |
  241|  61.7M|    if (! p_tree) {
  ------------------
  |  Branch (241:9): [True: 680, False: 61.7M]
  ------------------
  242|    680|        return;
  243|    680|    }
  244|       |
  245|  61.7M|    l_current_node = p_tree->nodes;
  246|  1.35G|    for (i = 0; i < p_tree->numnodes; ++i) {
  ------------------
  |  Branch (246:17): [True: 1.29G, False: 61.7M]
  ------------------
  247|  1.29G|        l_current_node->value = 999;
  248|  1.29G|        l_current_node->low = 0;
  249|  1.29G|        l_current_node->known = 0;
  250|  1.29G|        ++l_current_node;
  251|  1.29G|    }
  252|  61.7M|}
opj_tgt_decode:
  309|  2.58M|{
  310|  2.58M|    opj_tgt_node_t *stk[31];
  311|  2.58M|    opj_tgt_node_t **stkptr;
  312|  2.58M|    opj_tgt_node_t *node;
  313|  2.58M|    OPJ_INT32 low;
  314|       |
  315|  2.58M|    stkptr = stk;
  316|  2.58M|    node = &tree->nodes[leafno];
  317|  28.5M|    while (node->parent) {
  ------------------
  |  Branch (317:12): [True: 25.9M, False: 2.58M]
  ------------------
  318|  25.9M|        *stkptr++ = node;
  319|  25.9M|        node = node->parent;
  320|  25.9M|    }
  321|       |
  322|  2.58M|    low = 0;
  323|  28.5M|    for (;;) {
  324|  28.5M|        if (low > node->low) {
  ------------------
  |  Branch (324:13): [True: 3.74M, False: 24.8M]
  ------------------
  325|  3.74M|            node->low = low;
  326|  24.8M|        } else {
  327|  24.8M|            low = node->low;
  328|  24.8M|        }
  329|  28.8M|        while (low < threshold && low < node->value) {
  ------------------
  |  Branch (329:16): [True: 4.61M, False: 24.1M]
  |  Branch (329:35): [True: 251k, False: 4.36M]
  ------------------
  330|   251k|            if (opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (330:17): [True: 64.2k, False: 187k]
  ------------------
  331|  64.2k|                node->value = low;
  332|   187k|            } else {
  333|   187k|                ++low;
  334|   187k|            }
  335|   251k|        }
  336|  28.5M|        node->low = low;
  337|  28.5M|        if (stkptr == stk) {
  ------------------
  |  Branch (337:13): [True: 2.58M, False: 25.9M]
  ------------------
  338|  2.58M|            break;
  339|  2.58M|        }
  340|  25.9M|        node = *--stkptr;
  341|  25.9M|    }
  342|       |
  343|  2.58M|    return (node->value < threshold) ? 1 : 0;
  ------------------
  |  Branch (343:12): [True: 39.2k, False: 2.54M]
  ------------------
  344|  2.58M|}

opj_mutex_create:
  314|  2.24k|{
  315|  2.24k|    opj_mutex_t* mutex = (opj_mutex_t*) opj_calloc(1U, sizeof(opj_mutex_t));
  316|  2.24k|    if (mutex != NULL) {
  ------------------
  |  Branch (316:9): [True: 2.24k, False: 0]
  ------------------
  317|  2.24k|        if (pthread_mutex_init(&mutex->mutex, NULL) != 0) {
  ------------------
  |  Branch (317:13): [True: 0, False: 2.24k]
  ------------------
  318|      0|            opj_free(mutex);
  319|      0|            mutex = NULL;
  320|      0|        }
  321|  2.24k|    }
  322|  2.24k|    return mutex;
  323|  2.24k|}
opj_mutex_lock:
  326|  7.73k|{
  327|  7.73k|    pthread_mutex_lock(&(mutex->mutex));
  328|  7.73k|}
opj_mutex_unlock:
  331|  7.73k|{
  332|  7.73k|    pthread_mutex_unlock(&(mutex->mutex));
  333|  7.73k|}
opj_mutex_destroy:
  336|  11.0k|{
  337|  11.0k|    if (!mutex) {
  ------------------
  |  Branch (337:9): [True: 8.85k, False: 2.24k]
  ------------------
  338|  8.85k|        return;
  339|  8.85k|    }
  340|  2.24k|    pthread_mutex_destroy(&(mutex->mutex));
  341|  2.24k|    opj_free(mutex);
  342|  2.24k|}
opj_tls_get:
  530|  1.34M|{
  531|  1.34M|    int i;
  532|  1.34M|    for (i = 0; i < tls->key_val_count; i++) {
  ------------------
  |  Branch (532:17): [True: 1.33M, False: 1.87k]
  ------------------
  533|  1.33M|        if (tls->key_val[i].key == key) {
  ------------------
  |  Branch (533:13): [True: 1.33M, False: 0]
  ------------------
  534|  1.33M|            return tls->key_val[i].value;
  535|  1.33M|        }
  536|  1.33M|    }
  537|  1.87k|    return NULL;
  538|  1.34M|}
opj_tls_set:
  542|  1.87k|{
  543|  1.87k|    opj_tls_key_val_t* new_key_val;
  544|  1.87k|    int i;
  545|       |
  546|  1.87k|    if (tls->key_val_count == INT_MAX) {
  ------------------
  |  Branch (546:9): [True: 0, False: 1.87k]
  ------------------
  547|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  548|      0|    }
  549|  1.87k|    for (i = 0; i < tls->key_val_count; i++) {
  ------------------
  |  Branch (549:17): [True: 0, False: 1.87k]
  ------------------
  550|      0|        if (tls->key_val[i].key == key) {
  ------------------
  |  Branch (550:13): [True: 0, False: 0]
  ------------------
  551|      0|            if (tls->key_val[i].opj_free_func) {
  ------------------
  |  Branch (551:17): [True: 0, False: 0]
  ------------------
  552|      0|                tls->key_val[i].opj_free_func(tls->key_val[i].value);
  553|      0|            }
  554|      0|            tls->key_val[i].value = value;
  555|      0|            tls->key_val[i].opj_free_func = opj_free_func;
  556|      0|            return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  557|      0|        }
  558|      0|    }
  559|  1.87k|    new_key_val = (opj_tls_key_val_t*) opj_realloc(tls->key_val,
  560|  1.87k|                  ((size_t)tls->key_val_count + 1U) * sizeof(opj_tls_key_val_t));
  561|  1.87k|    if (!new_key_val) {
  ------------------
  |  Branch (561:9): [True: 0, False: 1.87k]
  ------------------
  562|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  563|      0|    }
  564|  1.87k|    tls->key_val = new_key_val;
  565|  1.87k|    new_key_val[tls->key_val_count].key = key;
  566|  1.87k|    new_key_val[tls->key_val_count].value = value;
  567|  1.87k|    new_key_val[tls->key_val_count].opj_free_func = opj_free_func;
  568|  1.87k|    tls->key_val_count ++;
  569|  1.87k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.87k|#define OPJ_TRUE 1
  ------------------
  570|  1.87k|}
opj_thread_pool_create:
  626|  8.85k|{
  627|  8.85k|    opj_thread_pool_t* tp;
  628|       |
  629|  8.85k|    tp = (opj_thread_pool_t*) opj_calloc(1, sizeof(opj_thread_pool_t));
  630|  8.85k|    if (!tp) {
  ------------------
  |  Branch (630:9): [True: 0, False: 8.85k]
  ------------------
  631|      0|        return NULL;
  632|      0|    }
  633|  8.85k|    tp->state = OPJWTS_OK;
  634|       |
  635|  8.85k|    if (num_threads <= 0) {
  ------------------
  |  Branch (635:9): [True: 8.85k, False: 0]
  ------------------
  636|  8.85k|        tp->tls = opj_tls_new();
  637|  8.85k|        if (!tp->tls) {
  ------------------
  |  Branch (637:13): [True: 0, False: 8.85k]
  ------------------
  638|      0|            opj_free(tp);
  639|      0|            tp = NULL;
  640|      0|        }
  641|  8.85k|        return tp;
  642|  8.85k|    }
  643|       |
  644|      0|    tp->mutex = opj_mutex_create();
  645|      0|    if (!tp->mutex) {
  ------------------
  |  Branch (645:9): [True: 0, False: 0]
  ------------------
  646|      0|        opj_free(tp);
  647|      0|        return NULL;
  648|      0|    }
  649|      0|    if (!opj_thread_pool_setup(tp, num_threads)) {
  ------------------
  |  Branch (649:9): [True: 0, False: 0]
  ------------------
  650|      0|        opj_thread_pool_destroy(tp);
  651|      0|        return NULL;
  652|      0|    }
  653|      0|    return tp;
  654|      0|}
opj_thread_pool_submit_job:
  830|  1.34M|{
  831|  1.34M|    opj_worker_thread_job_t* job;
  832|  1.34M|    opj_job_list_t* item;
  833|       |
  834|  1.34M|    if (tp->mutex == NULL) {
  ------------------
  |  Branch (834:9): [True: 1.34M, False: 0]
  ------------------
  835|  1.34M|        job_fn(user_data, tp->tls);
  836|  1.34M|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.34M|#define OPJ_TRUE 1
  ------------------
  837|  1.34M|    }
  838|       |
  839|      0|    job = (opj_worker_thread_job_t*)opj_malloc(sizeof(opj_worker_thread_job_t));
  840|      0|    if (job == NULL) {
  ------------------
  |  Branch (840:9): [True: 0, False: 0]
  ------------------
  841|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  842|      0|    }
  843|      0|    job->job_fn = job_fn;
  844|      0|    job->user_data = user_data;
  845|       |
  846|      0|    item = (opj_job_list_t*) opj_malloc(sizeof(opj_job_list_t));
  847|      0|    if (item == NULL) {
  ------------------
  |  Branch (847:9): [True: 0, False: 0]
  ------------------
  848|      0|        opj_free(job);
  849|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  850|      0|    }
  851|      0|    item->job = job;
  852|       |
  853|      0|    opj_mutex_lock(tp->mutex);
  854|       |
  855|      0|    tp->signaling_threshold = 100 * tp->worker_threads_count;
  856|      0|    while (tp->pending_jobs_count > tp->signaling_threshold) {
  ------------------
  |  Branch (856:12): [True: 0, False: 0]
  ------------------
  857|       |        /* printf("%d jobs enqueued. Waiting\n", tp->pending_jobs_count); */
  858|      0|        opj_cond_wait(tp->cond, tp->mutex);
  859|       |        /* printf("...%d jobs enqueued.\n", tp->pending_jobs_count); */
  860|      0|    }
  861|       |
  862|      0|    item->next = tp->job_queue;
  863|      0|    tp->job_queue = item;
  864|      0|    tp->pending_jobs_count ++;
  865|       |
  866|      0|    if (tp->waiting_worker_thread_list) {
  ------------------
  |  Branch (866:9): [True: 0, False: 0]
  ------------------
  867|      0|        opj_worker_thread_t* worker_thread;
  868|      0|        opj_worker_thread_list_t* next;
  869|      0|        opj_worker_thread_list_t* to_opj_free;
  870|       |
  871|      0|        worker_thread = tp->waiting_worker_thread_list->worker_thread;
  872|       |
  873|      0|        assert(worker_thread->marked_as_waiting);
  874|      0|        worker_thread->marked_as_waiting = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  875|       |
  876|      0|        next = tp->waiting_worker_thread_list->next;
  877|      0|        to_opj_free = tp->waiting_worker_thread_list;
  878|      0|        tp->waiting_worker_thread_list = next;
  879|      0|        tp->waiting_worker_thread_count --;
  880|       |
  881|      0|        opj_mutex_lock(worker_thread->mutex);
  882|      0|        opj_mutex_unlock(tp->mutex);
  883|      0|        opj_cond_signal(worker_thread->cond);
  884|      0|        opj_mutex_unlock(worker_thread->mutex);
  885|       |
  886|      0|        opj_free(to_opj_free);
  887|      0|    } else {
  888|      0|        opj_mutex_unlock(tp->mutex);
  889|      0|    }
  890|       |
  891|      0|    return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  892|      0|}
opj_thread_pool_wait_completion:
  896|  2.24k|{
  897|  2.24k|    if (tp->mutex == NULL) {
  ------------------
  |  Branch (897:9): [True: 2.24k, False: 0]
  ------------------
  898|  2.24k|        return;
  899|  2.24k|    }
  900|       |
  901|      0|    if (max_remaining_jobs < 0) {
  ------------------
  |  Branch (901:9): [True: 0, False: 0]
  ------------------
  902|      0|        max_remaining_jobs = 0;
  903|      0|    }
  904|      0|    opj_mutex_lock(tp->mutex);
  905|      0|    tp->signaling_threshold = max_remaining_jobs;
  906|      0|    while (tp->pending_jobs_count > max_remaining_jobs) {
  ------------------
  |  Branch (906:12): [True: 0, False: 0]
  ------------------
  907|       |        /*printf("tp=%p, jobs before wait = %d, max_remaining_jobs = %d\n", tp, tp->pending_jobs_count, max_remaining_jobs);*/
  908|      0|        opj_cond_wait(tp->cond, tp->mutex);
  909|       |        /*printf("tp=%p, jobs after wait = %d\n", tp, tp->pending_jobs_count);*/
  910|      0|    }
  911|      0|    opj_mutex_unlock(tp->mutex);
  912|      0|}
opj_thread_pool_get_thread_count:
  915|  1.34M|{
  916|  1.34M|    return tp->worker_threads_count;
  917|  1.34M|}
opj_thread_pool_destroy:
  920|  8.85k|{
  921|  8.85k|    if (!tp) {
  ------------------
  |  Branch (921:9): [True: 0, False: 8.85k]
  ------------------
  922|      0|        return;
  923|      0|    }
  924|  8.85k|    if (tp->cond) {
  ------------------
  |  Branch (924:9): [True: 0, False: 8.85k]
  ------------------
  925|      0|        int i;
  926|      0|        opj_thread_pool_wait_completion(tp, 0);
  927|       |
  928|      0|        opj_mutex_lock(tp->mutex);
  929|      0|        tp->state = OPJWTS_STOP;
  930|      0|        opj_mutex_unlock(tp->mutex);
  931|       |
  932|      0|        for (i = 0; i < tp->worker_threads_count; i++) {
  ------------------
  |  Branch (932:21): [True: 0, False: 0]
  ------------------
  933|      0|            opj_mutex_lock(tp->worker_threads[i].mutex);
  934|      0|            opj_cond_signal(tp->worker_threads[i].cond);
  935|      0|            opj_mutex_unlock(tp->worker_threads[i].mutex);
  936|      0|            opj_thread_join(tp->worker_threads[i].thread);
  937|      0|            opj_cond_destroy(tp->worker_threads[i].cond);
  938|      0|            opj_mutex_destroy(tp->worker_threads[i].mutex);
  939|      0|        }
  940|       |
  941|      0|        opj_free(tp->worker_threads);
  942|       |
  943|      0|        while (tp->waiting_worker_thread_list != NULL) {
  ------------------
  |  Branch (943:16): [True: 0, False: 0]
  ------------------
  944|      0|            opj_worker_thread_list_t* next = tp->waiting_worker_thread_list->next;
  945|      0|            opj_free(tp->waiting_worker_thread_list);
  946|      0|            tp->waiting_worker_thread_list = next;
  947|      0|        }
  948|       |
  949|      0|        opj_cond_destroy(tp->cond);
  950|      0|    }
  951|  8.85k|    opj_mutex_destroy(tp->mutex);
  952|  8.85k|    opj_tls_destroy(tp->tls);
  953|  8.85k|    opj_free(tp);
  954|  8.85k|}
thread.c:opj_tls_new:
  510|  8.85k|{
  511|  8.85k|    return (opj_tls_t*) opj_calloc(1, sizeof(opj_tls_t));
  512|  8.85k|}
thread.c:opj_tls_destroy:
  515|  8.85k|{
  516|  8.85k|    int i;
  517|  8.85k|    if (!tls) {
  ------------------
  |  Branch (517:9): [True: 0, False: 8.85k]
  ------------------
  518|      0|        return;
  519|      0|    }
  520|  10.7k|    for (i = 0; i < tls->key_val_count; i++) {
  ------------------
  |  Branch (520:17): [True: 1.87k, False: 8.85k]
  ------------------
  521|  1.87k|        if (tls->key_val[i].opj_free_func) {
  ------------------
  |  Branch (521:13): [True: 1.87k, False: 0]
  ------------------
  522|  1.87k|            tls->key_val[i].opj_free_func(tls->key_val[i].value);
  523|  1.87k|        }
  524|  1.87k|    }
  525|  8.85k|    opj_free(tls->key_val);
  526|  8.85k|    opj_free(tls);
  527|  8.85k|}

LLVMFuzzerInitialize:
  103|      2|{
  104|      2|    return 0;
  105|      2|}
LLVMFuzzerTestOneInput:
  111|  8.88k|{
  112|       |
  113|  8.88k|    OPJ_CODEC_FORMAT eCodecFormat;
  114|  8.88k|    if (len >= sizeof(jpc_header) &&
  ------------------
  |  Branch (114:9): [True: 8.88k, False: 1]
  ------------------
  115|  8.88k|            memcmp(buf, jpc_header, sizeof(jpc_header)) == 0) {
  ------------------
  |  Branch (115:13): [True: 8.85k, False: 34]
  ------------------
  116|  8.85k|        eCodecFormat = OPJ_CODEC_J2K;
  117|  8.85k|    } else {
  118|     35|        return 0;
  119|     35|    }
  120|       |
  121|  8.85k|    opj_codec_t* pCodec = opj_create_decompress(eCodecFormat);
  122|  8.85k|    opj_set_info_handler(pCodec, InfoCallback, NULL);
  123|  8.85k|    opj_set_warning_handler(pCodec, WarningCallback, NULL);
  124|  8.85k|    opj_set_error_handler(pCodec, ErrorCallback, NULL);
  125|       |
  126|  8.85k|    opj_dparameters_t parameters;
  127|  8.85k|    opj_set_default_decoder_parameters(&parameters);
  128|       |
  129|  8.85k|    opj_setup_decoder(pCodec, &parameters);
  130|       |
  131|  8.85k|    opj_stream_t *pStream = opj_stream_create(1024, OPJ_TRUE);
  ------------------
  |  |  117|  8.85k|#define OPJ_TRUE 1
  ------------------
  132|  8.85k|    MemFile memFile;
  133|  8.85k|    memFile.pabyData = buf;
  134|  8.85k|    memFile.nLength = len;
  135|  8.85k|    memFile.nCurPos = 0;
  136|  8.85k|    opj_stream_set_user_data_length(pStream, len);
  137|  8.85k|    opj_stream_set_read_function(pStream, ReadCallback);
  138|  8.85k|    opj_stream_set_seek_function(pStream, SeekCallback);
  139|  8.85k|    opj_stream_set_skip_function(pStream, SkipCallback);
  140|  8.85k|    opj_stream_set_user_data(pStream, &memFile, NULL);
  141|       |
  142|  8.85k|    opj_image_t * psImage = NULL;
  143|  8.85k|    if (!opj_read_header(pStream, pCodec, &psImage)) {
  ------------------
  |  Branch (143:9): [True: 1.37k, False: 7.47k]
  ------------------
  144|  1.37k|        opj_destroy_codec(pCodec);
  145|  1.37k|        opj_stream_destroy(pStream);
  146|  1.37k|        opj_image_destroy(psImage);
  147|  1.37k|        return 0;
  148|  1.37k|    }
  149|       |
  150|  7.47k|    OPJ_UINT32 width = psImage->x1 - psImage->x0;
  151|  7.47k|    OPJ_UINT32 height = psImage->y1 - psImage->y0;
  152|       |
  153|       |#if 0
  154|       |    // Reject too big images since that will require allocating a lot of
  155|       |    // memory
  156|       |    if (width != 0 && psImage->numcomps != 0 &&
  157|       |            (width > INT_MAX / psImage->numcomps ||
  158|       |             height > INT_MAX / (width * psImage->numcomps * sizeof(OPJ_UINT32)))) {
  159|       |        opj_stream_destroy(pStream);
  160|       |        opj_destroy_codec(pCodec);
  161|       |        opj_image_destroy(psImage);
  162|       |
  163|       |        return 0;
  164|       |    }
  165|       |
  166|       |    // Also reject too big tiles.
  167|       |    // TODO: remove this limitation when subtile decoding no longer imply
  168|       |    // allocation memory for whole tile
  169|       |    opj_codestream_info_v2_t* pCodeStreamInfo = opj_get_cstr_info(pCodec);
  170|       |    OPJ_UINT32 nTileW, nTileH;
  171|       |    nTileW = pCodeStreamInfo->tdx;
  172|       |    nTileH = pCodeStreamInfo->tdy;
  173|       |    opj_destroy_cstr_info(&pCodeStreamInfo);
  174|       |    if (nTileW > 2048 || nTileH > 2048) {
  175|       |        opj_stream_destroy(pStream);
  176|       |        opj_destroy_codec(pCodec);
  177|       |        opj_image_destroy(psImage);
  178|       |
  179|       |        return 0;
  180|       |    }
  181|       |#endif
  182|       |
  183|  7.47k|    OPJ_UINT32 width_to_read = width;
  184|  7.47k|    if (width_to_read > 1024) {
  ------------------
  |  Branch (184:9): [True: 2.47k, False: 5.00k]
  ------------------
  185|  2.47k|        width_to_read = 1024;
  186|  2.47k|    }
  187|  7.47k|    OPJ_UINT32 height_to_read = height;
  188|  7.47k|    if (height_to_read > 1024) {
  ------------------
  |  Branch (188:9): [True: 3.00k, False: 4.47k]
  ------------------
  189|  3.00k|        height_to_read = 1024;
  190|  3.00k|    }
  191|       |
  192|  7.47k|    if (opj_set_decode_area(pCodec, psImage,
  ------------------
  |  Branch (192:9): [True: 7.44k, False: 35]
  ------------------
  193|  7.47k|                            psImage->x0, psImage->y0,
  194|  7.47k|                            psImage->x0 + width_to_read,
  195|  7.47k|                            psImage->y0 + height_to_read)) {
  196|  7.44k|        if (opj_decode(pCodec, pStream, psImage)) {
  ------------------
  |  Branch (196:13): [True: 1.56k, False: 5.88k]
  ------------------
  197|       |            //printf("success\n");
  198|  1.56k|        }
  199|  7.44k|    }
  200|       |
  201|  7.47k|    opj_end_decompress(pCodec, pStream);
  202|  7.47k|    opj_stream_destroy(pStream);
  203|  7.47k|    opj_destroy_codec(pCodec);
  204|  7.47k|    opj_image_destroy(psImage);
  205|       |
  206|  7.47k|    return 0;
  207|  8.85k|}
opj_decompress_fuzzer_J2K.cpp:_ZL12InfoCallbackPKcPv:
   61|  42.9k|{
   62|  42.9k|}
opj_decompress_fuzzer_J2K.cpp:_ZL15WarningCallbackPKcPv:
   57|  1.13M|{
   58|  1.13M|}
opj_decompress_fuzzer_J2K.cpp:_ZL13ErrorCallbackPKcPv:
   50|  21.4k|{
   51|  21.4k|    (void)msg;
   52|       |    //fprintf(stderr, "%s\n", msg);
   53|  21.4k|}
opj_decompress_fuzzer_J2K.cpp:_ZL12ReadCallbackPvmS_:
   66|  15.3k|{
   67|  15.3k|    MemFile* memFile = (MemFile*)pUserData;
   68|       |    //printf("want to read %d bytes at %d\n", (int)memFile->nCurPos, (int)nBytes);
   69|  15.3k|    if (memFile->nCurPos >= memFile->nLength) {
  ------------------
  |  Branch (69:9): [True: 916, False: 14.4k]
  ------------------
   70|    916|        return -1;
   71|    916|    }
   72|  14.4k|    if (memFile->nCurPos + nBytes >= memFile->nLength) {
  ------------------
  |  Branch (72:9): [True: 8.94k, False: 5.50k]
  ------------------
   73|  8.94k|        size_t nToRead = memFile->nLength - memFile->nCurPos;
   74|  8.94k|        memcpy(pBuffer, memFile->pabyData + memFile->nCurPos, nToRead);
   75|  8.94k|        memFile->nCurPos = memFile->nLength;
   76|  8.94k|        return nToRead;
   77|  8.94k|    }
   78|  5.50k|    if (nBytes == 0) {
  ------------------
  |  Branch (78:9): [True: 0, False: 5.50k]
  ------------------
   79|      0|        return -1;
   80|      0|    }
   81|  5.50k|    memcpy(pBuffer, memFile->pabyData + memFile->nCurPos, nBytes);
   82|  5.50k|    memFile->nCurPos += nBytes;
   83|  5.50k|    return nBytes;
   84|  5.50k|}
opj_decompress_fuzzer_J2K.cpp:_ZL12SeekCallbacklPv:
   87|    952|{
   88|    952|    MemFile* memFile = (MemFile*)pUserData;
   89|       |    //printf("seek to %d\n", (int)nBytes);
   90|    952|    memFile->nCurPos = nBytes;
   91|    952|    return OPJ_TRUE;
  ------------------
  |  |  117|    952|#define OPJ_TRUE 1
  ------------------
   92|    952|}
opj_decompress_fuzzer_J2K.cpp:_ZL12SkipCallbacklPv:
   95|    478|{
   96|    478|    MemFile* memFile = (MemFile*)pUserData;
   97|    478|    memFile->nCurPos += nBytes;
   98|    478|    return nBytes;
   99|    478|}

